forked from mindspore-Ecosystem/mindspore
!49128 fix aicpu op SparseToDenseV2
Merge pull request !49128 from yanzhenxiang2020/fix_aicpu_sparsetodensev2
This commit is contained in:
commit
d18529fc0c
|
@ -760,6 +760,7 @@ constexpr auto kSparseTensorDenseMatmulOpName = "SparseTensorDenseMatmul";
|
|||
constexpr auto kSparseTensorDenseAddOpName = "SparseTensorDenseAdd";
|
||||
constexpr auto kSparseTensorToCSRSparseMatrixOpName = "SparseTensorToCSRSparseMatrix";
|
||||
constexpr auto kSparseToDenseOpName = "SparseToDense";
|
||||
constexpr auto kSparseToDenseV2OpName = "SparseToDenseV2";
|
||||
constexpr auto kSplitOpName = "Split";
|
||||
constexpr auto kSplitDOpName = "SplitD";
|
||||
constexpr auto kSplitVOpName = "SplitV";
|
||||
|
|
|
@ -147,7 +147,7 @@ KernelStatus SparseToDenseCpuKernel::ValidParam(const CpuKernelContext &ctx) {
|
|||
}
|
||||
|
||||
// default_value
|
||||
if (default_value_shape->GetDims() != 0) {
|
||||
if (default_value_shape->GetDims() != 0 && default_value_tensor->NumElements() != 1) {
|
||||
KERNEL_LOG_ERROR("Default_value should be a scalar, and got dim size [%d].", default_value_shape->GetDims());
|
||||
return KERNEL_STATUS_PARAM_INVALID;
|
||||
}
|
||||
|
|
|
@ -323,7 +323,7 @@ bool AICpuLibSelectPass::Process(const AnfNodePtr &node) const {
|
|||
mindspore::kMultiMarginLossGradOpName,
|
||||
mindspore::kSspaddmmOpName,
|
||||
mindspore::kBatchMatMulOpName,
|
||||
mindspore::kSparseToDenseOpName,
|
||||
mindspore::kSparseToDenseV2OpName,
|
||||
mindspore::kTrilOpName,
|
||||
mindspore::kBernoulliOpName};
|
||||
|
||||
|
|
|
@ -505,6 +505,7 @@ class SparseToDenseV2(Primitive):
|
|||
"""Initialize SparseToDenseV2."""
|
||||
self.add_prim_attr("max_length", 1000000)
|
||||
self.validate_indices = validate_indices
|
||||
validator.check_value_type('validate_indices', validate_indices, [bool], self.name)
|
||||
self.add_prim_attr("validate_indices", self.validate_indices)
|
||||
self.init_prim_io_names(
|
||||
inputs=['indices', 'output_shape', 'values', 'default_value'], outputs=['output'])
|
||||
|
|
Loading…
Reference in New Issue