-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
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
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)) | ||
|