Created
February 19, 2018 21:50
-
-
Save farizrahman4u/75b00d71c1e5fac5f640fe05bf6a8bb3 to your computer and use it in GitHub Desktop.
Jumpy bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jumpy | |
import numpy as np | |
jumpy.init() | |
def numpy(jp_array): | |
# convert back to numpy array | |
array = jp_array.array # INDArray instance | |
get = array.getDouble | |
shape = array.shape() | |
length = array.length() | |
scalars = [get(i) for i in range(length)] | |
return np.array(scalars).reshape(shape) | |
np_small = np.zeros((32,)) | |
jp_small = jumpy.from_np(np_small) | |
np_small = numpy(jp_small) | |
assert np_small.max() == 0 | |
np_big = np.zeros((3200,)) | |
jp_big = jumpy.from_np(np_big) | |
np_big = numpy(jp_big) | |
assert np_big.max() == 0, np_big.max() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment