@gof.local_optimizer([sparse.Remove0])
def local_inplace_remove0(node):
 if (isinstance(node.op, sparse.Remove0) and (not node.op.inplace)):
  new_op = node.op.__class__(inplace=True)
  new_node = new_op(*node.inputs)
  return [new_node]
 return False

@ gof . local_optimizer ( [ sparse . Remove0 ] ) def local_inplace_remove0 ( node ) : if ( isinstance ( node . op , sparse . Remove0 ) and ( not node . op . inplace ) ) : new_op = node . op . __class__ ( inplace = True ) new_node = new_op ( * node . inputs ) return [ new_node ] return False
optimization to insert inplace versions of remove0 .