提交 9828e7d1 authored 作者: Frederic's avatar Frederic

small opt speed up

上级 6c06233a
......@@ -1435,18 +1435,18 @@ def local_useless_elemwise(node):
return [T.fill(node.inputs[0],
T.constant(1.0,
dtype=node.outputs[0].type.dtype))]
if node.op.scalar_op == theano.scalar.neq and len(node.inputs) == 2:
elif node.op.scalar_op == theano.scalar.neq and len(node.inputs) == 2:
if node.inputs[0] == node.inputs[1]:
# it is the same var in the graph. That will always be false
return [T.fill(node.inputs[0],
T.constant(0.0,
dtype=node.outputs[0].type.dtype))]
if node.op.scalar_op == theano.scalar.mul and len(node.inputs) == 1:
elif node.op.scalar_op == theano.scalar.mul and len(node.inputs) == 1:
return [node.inputs[0]]
if node.op.scalar_op == theano.scalar.add and len(node.inputs) == 1:
elif node.op.scalar_op == theano.scalar.add and len(node.inputs) == 1:
return [node.inputs[0]]
if (node.op.scalar_op == theano.scalar.identity
elif (node.op.scalar_op == theano.scalar.identity
and len(node.inputs) == 1):
return [node.inputs[0]]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论