未验证 提交 c90dd843 编写于 作者: Z zhangkaihuo 提交者: GitHub

int32/64 does not call backward in unittest (#47604)

上级 da083436
...@@ -63,7 +63,6 @@ class TestSparseElementWiseAPI(unittest.TestCase): ...@@ -63,7 +63,6 @@ class TestSparseElementWiseAPI(unittest.TestCase):
csr_y = s_dense_y.to_sparse_csr() csr_y = s_dense_y.to_sparse_csr()
actual_res = get_actual_res(csr_x, csr_y, op) actual_res = get_actual_res(csr_x, csr_y, op)
actual_res.backward(actual_res)
expect_res = op(dense_x, dense_y) expect_res = op(dense_x, dense_y)
expect_res.backward(expect_res) expect_res.backward(expect_res)
...@@ -75,6 +74,7 @@ class TestSparseElementWiseAPI(unittest.TestCase): ...@@ -75,6 +74,7 @@ class TestSparseElementWiseAPI(unittest.TestCase):
equal_nan=True, equal_nan=True,
) )
if not (op == __truediv__ and dtype in ['int32', 'int64']): if not (op == __truediv__ and dtype in ['int32', 'int64']):
actual_res.backward(actual_res)
np.testing.assert_allclose( np.testing.assert_allclose(
dense_x.grad.numpy(), dense_x.grad.numpy(),
csr_x.grad.to_dense().numpy(), csr_x.grad.to_dense().numpy(),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册