提交 6cc267d5 authored 作者: Frederic's avatar Frederic

Remove some condition

上级 23573a95
...@@ -1533,16 +1533,16 @@ def local_elemwise_alloc_op(ElemwiseOP, AllocOP, DimShuffleOP): ...@@ -1533,16 +1533,16 @@ def local_elemwise_alloc_op(ElemwiseOP, AllocOP, DimShuffleOP):
# will remove that alloc later # will remove that alloc later
assert i.type.ndim == cmp_op.ndim assert i.type.ndim == cmp_op.ndim
get_shape = node.fgraph.shape_feature.get_shape get_shape = node.fgraph.shape_feature.get_shape
if (theano.config.experimental.local_alloc_elemwise_assert and if theano.config.experimental.local_alloc_elemwise_assert:
not same_shape(i, cmp_op)):
cond = [] cond = []
for idx in xrange(i.type.ndim): for idx in xrange(i.type.ndim):
if not i.type.broadcastable[idx]: if (not i.type.broadcastable[idx] and
# TODO: same_shape(i, cmp_op, dim_x=idx, dim_y=idx) not same_shape(i, cmp_op, idx, idx)):
i_shp = get_shape(i, idx) i_shp = get_shape(i, idx)
cmp_shp = get_shape(cmp_op, idx) cmp_shp = get_shape(cmp_op, idx)
cond.append(T.eq(i_shp, cmp_shp)) cond.append(T.eq(i_shp, cmp_shp))
assert_op = assert_(assert_op, *cond) if cond:
assert_op = assert_(assert_op, *cond)
new_i.append(i.owner.inputs[0]) new_i.append(i.owner.inputs[0])
# Remove Alloc in DimShuffle # Remove Alloc in DimShuffle
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论