Как воссоздать ось = 2 в np.repeat() для Numba ⇐ Python
-
Гость
Как воссоздать ось = 2 в np.repeat() для Numba
I'm trying to convert my code to Numba friendly implementation, however I keep running into errors with the axis argument (as it is not supported). Specifically, I need to use the np.repeat() function in axis=2
In numpy my code is:
original = np.random.rand(1000,1) no_repeats = 10 big_original = np.repeat(np.expand_dims((5)*original, axis=2), no_repeats, axis=2) How could I rewrite this in a Numba friendly way?
I have tried to use np.dstack:
expanded_original = np.expand_dims((5)*original, axis=2) big_original = np.dstack([expanded_original]*no_repeats) But of course lists aren't a supported datatype. How could I go about this in the most efficient way?
Источник: https://stackoverflow.com/questions/781 ... -for-numba
I'm trying to convert my code to Numba friendly implementation, however I keep running into errors with the axis argument (as it is not supported). Specifically, I need to use the np.repeat() function in axis=2
In numpy my code is:
original = np.random.rand(1000,1) no_repeats = 10 big_original = np.repeat(np.expand_dims((5)*original, axis=2), no_repeats, axis=2) How could I rewrite this in a Numba friendly way?
I have tried to use np.dstack:
expanded_original = np.expand_dims((5)*original, axis=2) big_original = np.dstack([expanded_original]*no_repeats) But of course lists aren't a supported datatype. How could I go about this in the most efficient way?
Источник: https://stackoverflow.com/questions/781 ... -for-numba