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];