code: def local_inplace_DiagonalSubtensor(node):
      """Also work for IncDiagonalSubtensor."""
      if (
          isinstance(node.op, (DiagonalSubtensor, IncDiagonalSubtensor))
          and not node.op.inplace
      ):
          new_op = node.op.__class__(inplace=True)
          new_node = new_op(*node.inputs)
          copy_stack_trace(node.outputs[0], new_node)
          return [new_node]
      return False
  
imports: from __future__ import absolute_import, print_function, division
  import theano
  from theano.gradient import DisconnectedType
  from theano.gof import Op, Apply, TopoOptimizer
  from theano.gof.opt import copy_stack_trace
  from theano import tensor
label_desc: Use image node_id 3 for calling a global function with example usage: local_inplace_DiagonalSubtensor(node) and returns: False, list