提交 7af85cad authored 作者: Frederic's avatar Frederic

Fix crash introduced in gh-1207 with theano variable that don't have the…

Fix crash introduced in gh-1207 with theano variable that don't have the broadcastable attribute like sparse and random variable.
上级 cbe0f119
...@@ -820,7 +820,8 @@ class ShapeFeature(object): ...@@ -820,7 +820,8 @@ class ShapeFeature(object):
shape_vars.append(self.lscalar_one) shape_vars.append(self.lscalar_one)
else: else:
shape_vars.append(self.unpack(s[i])) shape_vars.append(self.unpack(s[i]))
assert all([not r.type.broadcastable[i] or assert all([not hasattr(r.type, "broadcastable") or
not r.type.broadcastable[i] or
self.lscalar_one.equals(shape_vars[i]) or self.lscalar_one.equals(shape_vars[i]) or
self.lscalar_one.equals( self.lscalar_one.equals(
T.extract_constant(shape_vars[i])) T.extract_constant(shape_vars[i]))
...@@ -866,7 +867,8 @@ class ShapeFeature(object): ...@@ -866,7 +867,8 @@ class ShapeFeature(object):
merged_shape.append(r_shape[i]) merged_shape.append(r_shape[i])
else: else:
merged_shape.append(other_shape[i]) merged_shape.append(other_shape[i])
assert all([(not r.type.broadcastable[i] and assert all([(not hasattr(r.type, "broadcastable") or
not r.type.broadcastable[i] and
not other_r.type.broadcastable[i]) or not other_r.type.broadcastable[i]) or
self.lscalar_one.equals(merged_shape[i]) or self.lscalar_one.equals(merged_shape[i]) or
self.lscalar_one.equals( self.lscalar_one.equals(
...@@ -888,7 +890,8 @@ class ShapeFeature(object): ...@@ -888,7 +890,8 @@ class ShapeFeature(object):
new_shape.append(self.unpack(s_i)) new_shape.append(self.unpack(s_i))
else: else:
new_shape.append(s_j) new_shape.append(s_j)
assert all([not r.type.broadcastable[i] or assert all([not hasattr(r.type, "broadcastable") or
not r.type.broadcastable[i] or
self.lscalar_one.equals(new_shape[i]) or self.lscalar_one.equals(new_shape[i]) or
self.lscalar_one.equals(T.extract_constant(new_shape[i])) self.lscalar_one.equals(T.extract_constant(new_shape[i]))
for i in range(r.ndim)]) for i in range(r.ndim)])
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论