提交 8d23f912 authored 作者: Frederic's avatar Frederic

Fix crash.

上级 3d2f3f7b
...@@ -379,14 +379,18 @@ def _infer_ndim_bcast(ndim, shape, *args): ...@@ -379,14 +379,18 @@ def _infer_ndim_bcast(ndim, shape, *args):
ndim = template.ndim ndim = template.ndim
else: else:
v_shape = tensor.as_tensor_variable(shape) v_shape = tensor.as_tensor_variable(shape)
if v_shape.ndim != 1:
raise TypeError(
"shape must be a vector or list of scalar, got '%s'" % v_shape)
if ndim is None:
ndim = tensor.get_vector_length(v_shape)
bcast = [False] * ndim
if v_shape.ndim != 1: if v_shape.ndim != 1:
raise TypeError("shape must be a vector or list of scalar, got '%s'" % raise TypeError("shape must be a vector or list of scalar, got '%s'" %
v_shape) v_shape)
if ndim is None:
ndim = tensor.get_vector_length(v_shape)
bcast = [False] * ndim
if (not (v_shape.dtype.startswith('int') or if (not (v_shape.dtype.startswith('int') or
v_shape.dtype.startswith('uint'))): v_shape.dtype.startswith('uint'))):
raise TypeError('shape must be an integer vector or list', raise TypeError('shape must be an integer vector or list',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论