提交 e3f69de9 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Add check for ndim of the value in GpuAlloc.

上级 61f85841
......@@ -588,6 +588,9 @@ class GpuAlloc(HideC, Alloc):
def make_node(self, value, *shape):
value = as_gpuarray_variable(value)
sh, bcast = self.validate_shape(shape)
if value.ndim > len(sh):
TypeError("The GpuAlloc value to use has more dimensions "
"than the specified shape", v.ndim, len(sh))
otype = value.type.clone(broadcastable=bcast)
return Apply(self, [value] + sh, [otype()])
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论