From c0a17154a8f21f473c9376b855bb16e08acbd904 Mon Sep 17 00:00:00 2001 From: gsq7474741 <38883252+gsq7474741@users.noreply.github.com> Date: Mon, 18 Apr 2022 01:27:12 +0800 Subject: [PATCH] add sparse elementwise v0.7 --- .../phi/kernels/sparse/cpu/sparse_elementwise_kernel.cc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/paddle/phi/kernels/sparse/cpu/sparse_elementwise_kernel.cc b/paddle/phi/kernels/sparse/cpu/sparse_elementwise_kernel.cc index 52dd924a6722b..04d287673963b 100644 --- a/paddle/phi/kernels/sparse/cpu/sparse_elementwise_kernel.cc +++ b/paddle/phi/kernels/sparse/cpu/sparse_elementwise_kernel.cc @@ -30,13 +30,7 @@ namespace sparse { const SparseCsrTensor& x, \ const SparseCsrTensor& y, \ SparseCsrTensor* out) { \ - PADDLE_ENFORCE_EQ( \ - x.dims(), \ - y.dims(), \ - "ValueError: Mismatched shape. Expected x.dims = y.dims, " \ - "but got x.dims = %s, y.dims = %s", \ - x.dims().to_str(), \ - y.dims().to_str()); \ + PADDLE_ENFORCE_EQ(x.dims(), y.dims()); \ const auto& n_row = x.dims()[0]; \ const auto& n_col = x.dims()[1]; \ const auto& x_nnz = x.non_zero_elements().numel(); \ @@ -146,6 +140,7 @@ void ElementWiseDivideCsrKernel(const Context& dev_ctx, const SparseCsrTensor& x, const SparseCsrTensor& y, SparseCsrTensor* out) { + PADDLE_ENFORCE_EQ(x.dims(), y.dims()); const auto& n_row = x.dims()[0]; const auto& n_col = x.dims()[1]; const auto& x_nnz = x.non_zero_elements().numel();