!48597 complex cpu null check

Merge pull request !48597 from chenweifeng/complex-null-check-1
This commit is contained in:
i-robot 2023-02-09 02:49:07 +00:00 committed by Gitee
commit 28fc7534e2
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 10 additions and 1 deletions

View File

@ -74,6 +74,13 @@ int ComplexCpuKernelMod::Resize(const BaseOperatorPtr &base_operator, const std:
image_shape_ = inputs[1]->GetShapeVector();
out_shape_ = outputs[0]->GetShapeVector();
is_null_input_ = CHECK_SHAPE_NULL(real_shape_, kernel_name_, "real") ||
CHECK_SHAPE_NULL(image_shape_, kernel_name_, "image") ||
CHECK_SHAPE_NULL(out_shape_, kernel_name_, "output");
if (is_null_input_) {
return KRET_OK;
}
real_bcast_.clear();
image_bcast_.clear();
auto real_offset = out_shape_.size() - real_shape_.size();
@ -97,7 +104,7 @@ int ComplexCpuKernelMod::Resize(const BaseOperatorPtr &base_operator, const std:
template <typename T>
bool ComplexCpuKernelMod::LaunchKernel(const std::vector<AddressPtr> &inputs, const std::vector<AddressPtr> &outputs) {
if (out_shape_.size() == 0) {
if (is_null_input_) {
return true;
}

View File

@ -59,6 +59,8 @@ class ComplexCpuKernelMod : public NativeCpuKernelMod {
std::vector<int64_t> real_bcast_;
std::vector<int64_t> image_bcast_;
bool is_null_input_{false};
};
} // namespace kernel
} // namespace mindspore