gyshi commented on a change in pull request #15973: Numpy . implement numpy op exp2 with tvm URL: https://github.com/apache/incubator-mxnet/pull/15973#discussion_r323523342
########## File path: tests/python/unittest/test_numpy_op.py ########## @@ -1744,6 +1747,52 @@ def test_indexing_mode(sampler, set_size, samples_size, replace, weight=None): test_indexing_mode(test_choice_weighted, num_classes, num_classes // 2, replace, weight) +@with_seed() +@use_np +def test_np_exp2(): + if _features.is_enabled("TVM_OP"): + class Testexp2(HybridBlock): + def __init__(self): + super(Testexp2, self).__init__() + + def hybrid_forward(self, F, x, *args, **kwargs): + return F.np.exp2(x) + + shapes = [ + (), + (2,), + (2, 1, 2), + (2, 0, 2), + (1, 2, 3, 4, 5), + (6, 6, 6, 6, 6), + ] + dtypes = ['int8', 'int32', 'int64', 'float32', 'float64'] + + for hybridize in [True, False]: + for shape in shapes: + for dtype in dtypes: + test_exp2 = Testexp2() + if hybridize: + test_exp2.hybridize() + x = rand_ndarray(shape=shape, dtype=dtype).as_np_ndarray() + x.attach_grad() + np_out = _np.exp2(x.asnumpy()) + with mx.autograd.record(): + mx_out = test_exp2(x) + mx_out.backward() + log2 = 0.6931471805599453 Review comment: thx, i will resolved ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services