@register_specialize
@gof.local_optimizer([T.Elemwise])
def local_elemwise_sub_zeros(node):
 if (isinstance(node.op, T.Elemwise) and (node.op.scalar_op.nin == 2) and (node.op.scalar_op == scalar.sub) and (node.inputs[0] == node.inputs[1])):
  res = T.zeros_like(node.inputs[0])
  copy_stack_trace(node.outputs, res)
  return [res]

@ register_specialize @ gof . local_optimizer ( [ T . Elemwise ] ) def local_elemwise_sub_zeros ( node ) : if ( isinstance ( node . op , T . Elemwise ) and ( node . op . scalar_op . nin == 2 ) and ( node . op . scalar_op == scalar . sub ) and ( node . inputs [ 0 ] == node . inputs [ 1 ] ) ) : res = T . zeros_like ( node . inputs [ 0 ] ) copy_stack_trace ( node . outputs , res ) return [ res ]
elemwise{sub} -> zeros_like(x) .