diff --git a/mindspore/ccsrc/kernel/gpu/gpu_kernel.h b/mindspore/ccsrc/kernel/gpu/gpu_kernel.h index e8b621aed6437a47caaf37a260b293e91597345e..c935798f065750009e7bdf8c323c33d272e29f5b 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]));