Skip to content

Instantly share code, notes, and snippets.

@npetrenko
Created December 16, 2018 14:46
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 npetrenko/08dbf72035fe73a33b2cb6497b031289 to your computer and use it in GitHub Desktop.
Save npetrenko/08dbf72035fe73a33b2cb6497b031289 to your computer and use it in GitHub Desktop.
def test_shape():
arr = np.random.normal(size=(2,1,2,3,1,4,5))
boundaries, quantized = quantize(arr, 20)
assert np.all(quantized.shape == arr.shape)
boundaries_slow, quantized_slow = quantize_slow(arr.reshape(-1), 20)
boundaries_slow = boundaries_slow.reshape(boundaries.shape)
quantized_slow = quantized_slow.reshape(quantized.shape)
assert np.all(boundaries == boundaries_slow)
assert np.all(quantized == quantized_slow)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment