提交 84169272 authored 作者: Sina Honari's avatar Sina Honari

fixing error for scalar variables

上级 f9ce967a
...@@ -4400,6 +4400,11 @@ class Reshape(Op): ...@@ -4400,6 +4400,11 @@ class Reshape(Op):
# Here, we only simplify if the shape (node.inputs[1]) is a constant, # Here, we only simplify if the shape (node.inputs[1]) is a constant,
# ideally it would suffice to check that it is always non-negative. # ideally it would suffice to check that it is always non-negative.
# If current variable is a scalar and its dimensionality should
# change to self.ndim, then use size 1 for all new dimensions.
if len(ishapes[0]) == 0:
return [(1,) * self.ndim]
requ = node.inputs[1] requ = node.inputs[1]
if isinstance(requ, theano.tensor.TensorConstant): if isinstance(requ, theano.tensor.TensorConstant):
requ = list(requ.data) requ = list(requ.data)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论