micropython-ulab/tests/2d/numpy/or.py
Zoltán Vörös 5279de73ab
implement AND, OR, XOR binary operators (#639)
* implement AND, OR, XOR binary operators

* fix unterminated if

* add missing linebreak

* add more linebreaks

* remove leading linebreak
2023-07-21 21:57:31 +02:00

21 lines
No EOL
538 B
Python

try:
from ulab import numpy as np
except ImportError:
import numpy as np
dtypes = (np.uint8, np.int8, np.uint16, np.int16)
for dtype_a in dtypes:
a = np.array(range(5), dtype=dtype_a)
for dtype_b in dtypes:
b = np.array(range(250, 255), dtype=dtype_b)
try:
print('a | b: ', a | b)
except Exception as e:
print(e)
b = np.array([False, True, False, True, False], dtype=np.bool)
try:
print('a | b (bool): ', a | b)
except Exception as e:
print(e)