!11231 the output of resize_nearest/bilinear ops memset to zero

From: @caojian05
Reviewed-by: @wuxuejian,@zhouyaqiang0,@kisnwang
Signed-off-by: @wuxuejian,@kisnwang
This commit is contained in:
mindspore-ci-bot 2021-01-14 10:21:25 +08:00 committed by Gitee
commit 4d81cd2af7
2 changed files with 11 additions and 0 deletions

View File

@ -54,6 +54,11 @@ void ResizeBilinearGradCPUKernel::LaunchKernel(const std::vector<AddressPtr> &in
auto dloss_addr = reinterpret_cast<T *>(inputs[0]->addr);
auto output_addr = reinterpret_cast<T *>(outputs[0]->addr);
auto ret = memset_s(output_addr, outputs[0]->size, 0, outputs[0]->size);
if (ret != EOK) {
MS_LOG(ERROR) << "Output buffer memset failed, ret:" << ret;
}
size_t batch_size = shape_[0];
size_t channel = shape_[1];
size_t in_height = shape_[2];

View File

@ -55,6 +55,12 @@ void ResizeNearestNeighborGradCPUKernel::LaunchKernel(const std::vector<AddressP
const std::vector<AddressPtr> &outputs) {
auto dloss_addr = reinterpret_cast<T *>(inputs[0]->addr);
auto output_addr = reinterpret_cast<T *>(outputs[0]->addr);
auto ret = memset_s(output_addr, outputs[0]->size, 0, outputs[0]->size);
if (ret != EOK) {
MS_LOG(ERROR) << "Output buffer memset failed, ret:" << ret;
}
size_t in_hw_size = in_width_ * in_height_;
size_t out_hw_size = out_width_ * out_height_;