Skip to content

Instantly share code, notes, and snippets.

@farizrahman4u
Created February 19, 2018 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save farizrahman4u/75b00d71c1e5fac5f640fe05bf6a8bb3 to your computer and use it in GitHub Desktop.
Save farizrahman4u/75b00d71c1e5fac5f640fe05bf6a8bb3 to your computer and use it in GitHub Desktop.
Jumpy bug
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