From 1498953ea08f2f38b3f9157f20f828b70c7626cc Mon Sep 17 00:00:00 2001 From: linqingke Date: Tue, 29 Jun 2021 17:30:07 +0800 Subject: [PATCH] fix output_size zero bug. --- .../backend/kernel_compiler/gpu/arrays/gather_gpu_kernel.h | 3 --- .../kernel_compiler/gpu/arrays/gather_grad_gpu_kernel.h | 3 --- mindspore/ccsrc/backend/session/anf_runtime_algorithm.h | 3 --- 3 files changed, 9 deletions(-) diff --git a/mindspore/ccsrc/backend/kernel_compiler/gpu/arrays/gather_gpu_kernel.h b/mindspore/ccsrc/backend/kernel_compiler/gpu/arrays/gather_gpu_kernel.h index 3f2c258d8ef..71aae2d3754 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/gpu/arrays/gather_gpu_kernel.h +++ b/mindspore/ccsrc/backend/kernel_compiler/gpu/arrays/gather_gpu_kernel.h @@ -97,9 +97,6 @@ class GatherGpuFwdKernel : public GpuKernel { return; } size_t GetSize(const std::vector &shape, const bool flag = true) const { - if (shape.size() == 0) { - return 0; - } size_t result = flag ? sizeof(T) : sizeof(S); for (size_t i = 0; i < shape.size(); i++) { result *= shape[i]; diff --git a/mindspore/ccsrc/backend/kernel_compiler/gpu/arrays/gather_grad_gpu_kernel.h b/mindspore/ccsrc/backend/kernel_compiler/gpu/arrays/gather_grad_gpu_kernel.h index e47d4140c96..bb622dc6c4f 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/gpu/arrays/gather_grad_gpu_kernel.h +++ b/mindspore/ccsrc/backend/kernel_compiler/gpu/arrays/gather_grad_gpu_kernel.h @@ -98,9 +98,6 @@ class GatherGradGpuKernel : public GpuKernel { return; } size_t GetSize(const std::vector &shape, const bool flag = true) const { - if (shape.size() == 0) { - return 0; - } size_t result = flag ? sizeof(T) : sizeof(S); for (size_t i = 0; i < shape.size(); i++) { result *= shape[i]; diff --git a/mindspore/ccsrc/backend/session/anf_runtime_algorithm.h b/mindspore/ccsrc/backend/session/anf_runtime_algorithm.h index d75c4f62380..3a1bea2d27e 100644 --- a/mindspore/ccsrc/backend/session/anf_runtime_algorithm.h +++ b/mindspore/ccsrc/backend/session/anf_runtime_algorithm.h @@ -288,9 +288,6 @@ class AnfRuntimeAlgorithm { // Calc tensor size in byte. template static size_t TensorSizeInByte(const std::vector &shape) { - if (shape.size() == 0) { - return 0; - } size_t result = sizeof(T); for (size_t i = 0; i < shape.size(); i++) { result *= shape[i];