diff --git a/mindspore/ccsrc/plugin/device/cpu/kernel/eigen/sparse_sparse_maximum_cpu_kernel.cc b/mindspore/ccsrc/plugin/device/cpu/kernel/eigen/sparse_sparse_maximum_cpu_kernel.cc index ed16e3a7759..4a14e95c5d4 100644 --- a/mindspore/ccsrc/plugin/device/cpu/kernel/eigen/sparse_sparse_maximum_cpu_kernel.cc +++ b/mindspore/ccsrc/plugin/device/cpu/kernel/eigen/sparse_sparse_maximum_cpu_kernel.cc @@ -201,6 +201,17 @@ void SparseSparseMaximumCpuKernelMod::CheckInputShape(const std::vector &inputs) { + auto a_shape_ptr = reinterpret_cast(inputs[kInputa_shapes]->addr); + auto b_shape_ptr = reinterpret_cast(inputs[kInputb_shapes]->addr); + for (int64_t i = 0; i < num_dims_; ++i) { + if (a_shape_ptr[i] != b_shape_ptr[i]) { + MS_LOG(EXCEPTION) << "For '" << kernel_name_ << "', operand's shapes do not match at index " << i + << ", got value: " << a_shape_ptr[i] << ", and " << b_shape_ptr[i]; + } + } +} + bool SparseSparseMaximumCpuKernelMod::Launch(const std::vector &inputs, const std::vector &, const std::vector &outputs) { @@ -227,6 +238,7 @@ bool SparseSparseMaximumCpuKernelMod::LaunchKernel(const std::vector(inputs[kInputa_values]->addr); Eigen::DSizes a_values_size(EIGEN_SHAPE_CAST(a_values_shape0_)); diff --git a/mindspore/ccsrc/plugin/device/cpu/kernel/eigen/sparse_sparse_maximum_cpu_kernel.h b/mindspore/ccsrc/plugin/device/cpu/kernel/eigen/sparse_sparse_maximum_cpu_kernel.h index 232ca2706aa..3673b3febed 100644 --- a/mindspore/ccsrc/plugin/device/cpu/kernel/eigen/sparse_sparse_maximum_cpu_kernel.h +++ b/mindspore/ccsrc/plugin/device/cpu/kernel/eigen/sparse_sparse_maximum_cpu_kernel.h @@ -51,6 +51,7 @@ class SparseSparseMaximumCpuKernelMod : public NativeCpuKernelMod { bool LaunchKernel(const std::vector &inputs, const std::vector &outputs); void CheckInputShape(const std::vector &inputs, const int64_t a_nnz, const int64_t b_nnz, const int64_t num_dims); + void CheckShapeMatch(const std::vector &inputs); std::vector outputs_; TypeId dtype_{kTypeUnknown};