@register_specialize
@register_stabilize
@register_canonicalize
@register_useless
@gof.local_optimizer([T.alloc])
def local_useless_alloc(node):
 op = node.op
 if (not isinstance(op, Alloc)):
  return False
 input = node.inputs[0]
 output = node.outputs[0]
 if (input.type == output.type):
  return [input]

@ register_specialize @ register_stabilize @ register_canonicalize @ register_useless @ gof . local_optimizer ( [ T . alloc ] ) def local_useless_alloc ( node ) : op = node . op if ( not isinstance ( op , Alloc ) ) : return False input = node . inputs [ 0 ] output = node . outputs [ 0 ] if ( input . type == output . type ) : return [ input ]
if the input type is the same as the output type there is no change in the shape of the input .