Browse Source

!2225 GPU shape check

Merge pull request !2225 from VectorSL/shape-check
tags/v0.5.0-beta
mindspore-ci-bot Gitee 5 years ago
parent
commit
f96dcb026a
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      mindspore/ccsrc/kernel/gpu/gpu_kernel.h

+ 3
- 0
mindspore/ccsrc/kernel/gpu/gpu_kernel.h View File

@@ -64,6 +64,9 @@ class GpuKernel : public KernelMod {
}
// expand Nd Shape to 4d (N in [0,4])
void ShapeNdTo4d(const std::vector<size_t> &src, std::vector<int> *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]));


Loading…
Cancel
Save