Skip to content

Commit

Permalink
[Frontend][MXNet] add _npi_subtract_scalar
Browse files Browse the repository at this point in the history
  • Loading branch information
insop committed Jan 3, 2021
1 parent 6258fae commit 426e048
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions python/tvm/relay/frontend/mxnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -2693,6 +2693,8 @@ def _mx_npi_where_rscalar(inputs, attrs):
"_npi_multiply_scalar": _binop_scalar(_op.multiply),
"_npi_add": _rename(_op.add),
"_npi_add_scalar": _binop_scalar(_op.add),
"_npi_subtract": _rename(_op.subtract),
"_npi_subtract_scalar": _binop_scalar(_op.subtract),
"_npi_where_rscalar": _mx_npi_where_rscalar,
"_npi_less": _rename(_op.less),
"_npi_less_equal": _mx_compare(_op.less_equal, _rename),
Expand Down
13 changes: 8 additions & 5 deletions tests/python/frontend/mxnet/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -1983,7 +1983,6 @@ def test_forward_npi_transpose(data_shape, axes, dtype, target, ctx, kind):
op_res = intrp.evaluate()(data_np)
tvm.testing.assert_allclose(op_res.asnumpy(), ref_res.asnumpy(), rtol=1e-5)


@pytest.mark.parametrize(
"data_shape1, data_shape2, axis",
[
Expand Down Expand Up @@ -2062,8 +2061,10 @@ def test_forward_npx_reshape(data_shape, out_shape, dtype, target, reverse, ctx,
@tvm.testing.parametrize_targets
@pytest.mark.parametrize("kind", ["graph", "vm", "debug"])
def test_forward_npi_binary(data_shape, dtype, target, ctx, kind):
ref_ops = [mx.np.power, mx.np.multiply, mx.np.add, mx.np.less]
mx_ops = [mx.sym.np.power, mx.sym.np.multiply, mx.sym.np.add, mx.sym.np.less]
ref_ops = [mx.np.power, mx.np.multiply, mx.np.add,
mx.np.subtract, mx.np.less]
mx_ops = [mx.sym.np.power, mx.sym.np.multiply, mx.sym.np.add,
mx.sym.np.subtract, mx.sym.np.less]
for i in range(len(ref_ops)):
ref_op = ref_ops[i]
mx_op = mx_ops[i]
Expand Down Expand Up @@ -2092,8 +2093,10 @@ def test_forward_npi_binary(data_shape, dtype, target, ctx, kind):
@pytest.mark.parametrize("scalar", [1.0, 2.0, 3.0, 4.0])
@pytest.mark.parametrize("kind", ["graph", "vm", "debug"])
def test_forward_npi_binary_scalar(data_shape, dtype, scalar, target, ctx, kind):
ref_ops = [mx.np.power, mx.np.multiply, mx.np.add, mx.np.true_divide]
mx_ops = [mx.sym.np.power, mx.sym.np.multiply, mx.sym.np.add, mx.sym.np.true_divide]
ref_ops = [mx.np.power, mx.np.multiply, mx.np.add,
mx.np.subtract, mx.np.true_divide]
mx_ops = [mx.sym.np.power, mx.sym.np.multiply, mx.sym.np.add,
mx.sym.np.subtract, mx.sym.np.true_divide]
for i in range(len(ref_ops)):
ref_op = ref_ops[i]
mx_op = mx_ops[i]
Expand Down

0 comments on commit 426e048

Please sign in to comment.