From 9f0ae32d15b2eb4f7776035681c676e063abae89 Mon Sep 17 00:00:00 2001 From: VectorSL Date: Wed, 17 Jun 2020 16:12:15 +0800 Subject: [PATCH] gpu update shapecheck --- mindspore/ccsrc/kernel/gpu/gpu_kernel.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mindspore/ccsrc/kernel/gpu/gpu_kernel.h b/mindspore/ccsrc/kernel/gpu/gpu_kernel.h index e8b621aed..c935798f0 100644 --- a/mindspore/ccsrc/kernel/gpu/gpu_kernel.h +++ b/mindspore/ccsrc/kernel/gpu/gpu_kernel.h @@ -64,6 +64,9 @@ class GpuKernel : public KernelMod { } // expand Nd Shape to 4d (N in [0,4]) void ShapeNdTo4d(const std::vector &src, std::vector *dst) { + if (src.size() > 4) { + MS_EXCEPTION(ValueError) << src.size() << "-D data is not supported!"; + } dst->push_back(src.size() < 4 ? 1 : SizeToInt(src[src.size() - 4])); dst->push_back(src.size() < 3 ? 1 : SizeToInt(src[src.size() - 3])); dst->push_back(src.size() < 2 ? 1 : SizeToInt(src[src.size() - 2])); -- GitLab