haojin2 commented on a change in pull request #16025: Numpy add numpy op
left_shift and right_shift
URL: https://github.com/apache/incubator-mxnet/pull/16025#discussion_r319812120
##########
File path: tests/python/unittest/test_numpy_op.py
##########
@@ -1126,6 +1126,62 @@ def test_np_randint():
verify_generator(generator=generator_mx_same_seed,
buckets=buckets, probs=probs, nrepeat=100)
+@with_seed()
+@use_np
+def test_np_left_shift():
+ class TestLeftShift(HybridBlock):
+ def __init__(self):
+ super(TestLeftShift, self).__init__()
+
+ def hybrid_forward(self, F, a, b):
+ return F.np.left_shift(a, b)
+
+ @use_np
+ class TestRightShift(HybridBlock):
+ def __init__(self):
+ super(TestRightShift, self).__init__()
+
+ def hybrid_forward(self, F, a, b):
+ return F.np.right_shift(a, b)
+
+ shapes = [
+ ((), ()),
+ ((), (2,)),
+ ((3,), ()),
+ ((3, 4), (3, 4)),
+ ((3, 4, 5, 6), (6,)),
+ ((2, 0, 3), (3,)),
+ ((2, 1, 3), (2, 3))
+ ]
+ dtypes = ['uint8', 'int8', 'int32', 'int64']
+ for shape in shapes:
+ a, b = shape[0], shape[1]
+ for dtype in dtypes:
+ for hybridize in [True, False]:
+ test_left_shift = TestLeftShift()
+ test_right_shift = TestRightShift()
Review comment:
```Python
# other for-loops
for func in ['left_shift', 'right_shift']:
# other for-loops
test_shift = TestShift(func)
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services