@gof.local_optimizer([IncSubtensor], inplace=True)
def local_inplace_setsubtensor(node):
 if (isinstance(node.op, IncSubtensor) and (not node.op.inplace)):
  dta = node.op.destroyhandler_tolerate_aliased
  new_op = node.op.__class__(node.op.idx_list, inplace=True, set_instead_of_inc=node.op.set_instead_of_inc, destroyhandler_tolerate_aliased=dta)
  new_node = new_op(*node.inputs)
  val = getattr(node.outputs[0].tag, 'nan_guard_mode_check', True)
  new_node.tag.nan_guard_mode_check = val
  copy_stack_trace(node.outputs, new_node)
  return [new_node]
 return False

@ gof . local_optimizer ( [ IncSubtensor ] , inplace = True ) def local_inplace_setsubtensor ( node ) : if ( isinstance ( node . op , IncSubtensor ) and ( not node . op . inplace ) ) : dta = node . op . destroyhandler_tolerate_aliased new_op = node . op . __class__ ( node . op . idx_list , inplace = True , set_instead_of_inc = node . op . set_instead_of_inc , destroyhandler_tolerate_aliased = dta ) new_node = new_op ( * node . inputs ) val = getattr ( node . outputs [ 0 ] . tag , 'nan_guard_mode_check' , True ) new_node . tag . nan_guard_mode_check = val copy_stack_trace ( node . outputs , new_node ) return [ new_node ] return False
also work for gpuincsubtensor .