diff --git a/src/operator/numpy/np_matrix_op.cc b/src/operator/numpy/np_matrix_op.cc index e69d89b1149e..19e147467917 100644 --- a/src/operator/numpy/np_matrix_op.cc +++ b/src/operator/numpy/np_matrix_op.cc @@ -398,18 +398,18 @@ NNVM_REGISTER_OP(_np_roll) .set_attr("FInferType", ElemwiseType<1, 1>) .set_attr("FCompute", NumpyRollCompute) .set_attr("FGradient", - [](const nnvm::NodePtr& n, const std::vector& ograds) { - const NumpyRollParam& param = nnvm::get(n->attrs.parsed); - std::ostringstream os1; - os1 << param.shift; - std::ostringstream os2; - os2 << param.axis; - return MakeNonlossGradNode("_np_roll", n, ograds, {}, - {{"shift", os1.str()}, {"axis", os2.str()}}); + [](const nnvm::NodePtr& n, const std::vector& ograds) { + const NumpyRollParam& param = nnvm::get(n->attrs.parsed); + std::ostringstream os1; + os1 << param.shift; + std::ostringstream os2; + os2 << param.axis; + return MakeNonlossGradNode("_np_roll", n, ograds, {}, + {{"shift", os1.str()}, {"axis", os2.str()}}); }) .set_attr("FResourceRequest", - [](const NodeAttrs& n) { - return std::vector{ResourceRequest::kTempSpace}; + [](const NodeAttrs& n) { + return std::vector{ResourceRequest::kTempSpace}; }) .add_argument("data", "NDArray-or-Symbol", "Input ndarray") .add_arguments(NumpyRollParam::__FIELDS__()); diff --git a/tests/python/unittest/test_numpy_op.py b/tests/python/unittest/test_numpy_op.py index 52c890031f50..23fddc2e37d0 100644 --- a/tests/python/unittest/test_numpy_op.py +++ b/tests/python/unittest/test_numpy_op.py @@ -1999,7 +1999,6 @@ def hybrid_forward(self, F, x): assert same(mx_out.asnumpy(), np_out) assert same(x.grad.shape, x.shape) assert same(x.grad.asnumpy(), _np.ones(shape)) - # test imperativen np_out = _np.roll(x.asnumpy(), shift=shift, axis=axis) mx_out = np.roll(x, shift=shift, axis=axis)