code: def local_reshape_dimshuffle(node):
      """
      If a dimshuffle is inside a reshape and does not change the order
      of dimensions, remove it.
  
      Reshape(Dimshuffle(x), shp) -> Reshape(x, shp)
      """
      if isinstance(node.op, T.Reshape):
          input_ = node.inputs[0]
          if input_.owner and isinstance(input_.owner.op, DimShuffle):
              new_order = input_.owner.op.new_order
              offset = 0
              for dim in new_order:
                  if dim == "x":
                      continue
                  elif dim != offset:
                      return False
                  else:
                      offset += 1
              return [
                  T.reshape(
                      input_.owner.inputs[0],
                      node.inputs[1],
                      ndim=node.outputs[0].ndim,
                  )
              ]
      return False
  
file_path: Theano/theano/tensor/opt_uncanonicalize.py
imports: from __future__ import absolute_import, print_function, division
  import logging
  from theano import gof
  from theano.tensor.elemwise import CAReduce
  from theano.tensor import basic
  from theano.tensor import DimShuffle, Subtensor
  from theano.tensor.opt import register_uncanonicalize
  from theano import scalar
  from theano.gof.opt import copy_stack_trace
label_desc: Use image node_id 4 for calling a global function with example usage: local_reshape_dimshuffle(node) and returns: False, list, False