Skip to content

Commit

Permalink
add rudimentary test script
Browse files Browse the repository at this point in the history
  • Loading branch information
v923z committed Oct 5, 2024
1 parent 34d94d5 commit 564cf37
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/2d/numpy/take.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
try:
from ulab import numpy as np
except:
import numpy as np

dtypes = (np.uint8, np.int8, np.uint16, np.int16, np.float)

print('flattened array')
for dtype in dtypes:
a = np.array(range(12), dtype=dtype).reshape((3, 4))
print(np.take(a, (0, 10)))

for dtype in dtypes:
a = np.array(range(12), dtype=dtype).reshape((3, 4))
print('\na:', a)
print('\nfirst axis')
print(np.take(a, (0, 2, 2, 1), axis=0))
print('\nsecond axis')
print(np.take(a, (0, 2, 2, 1), axis=1))

0 comments on commit 564cf37

Please sign in to comment.