the output of resize_nearest/bilinear ops memset to zero.

This commit is contained in:
CaoJian 2021-01-13 16:55:51 +08:00
parent 6b2fabd01e
commit 119212d9e6
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_;