code: def local_blockwise_advanced_inc_subtensor(fgraph, node):
      """Rewrite blockwise advanced inc_subtensor whithout batched indexes as an inc_subtensor with prepended empty slices."""
      if not isinstance(node.op.core_op, AdvancedIncSubtensor):
          return None
  
      x, y, *idxs = node.inputs
  
      # It is currently not possible to Vectorize such AdvancedIncSubtensor, but we check again just in case
      if any(
          (
              isinstance(idx, (SliceType, NoneTypeT))
              or (idx.type.dtype == "bool" and idx.type.ndim > 0)
          )
          for idx in idxs
      ):
          return None
  
      op: Blockwise = node.op  # type: ignore
      batch_ndim = op.batch_ndim(node)
  
      new_idxs = []
      for idx in idxs:
          if all(idx.type.broadcastable[:batch_ndim]):
              new_idxs.append(idx.squeeze(tuple(range(batch_ndim))))
          else:
              # Rewrite does not apply
              return None
  
      x_batch_bcast = x.type.broadcastable[:batch_ndim]
      y_batch_bcast = y.type.broadcastable[:batch_ndim]
      if any(
          xb and not yb for xb, yb in zip(x_batch_bcast, y_batch_bcast)
      ):
          # Need to broadcast batch x dims
          batch_shape = tuple(
              x_dim if (not xb or yb) else y_dim
              for xb, x_dim, yb, y_dim in zip(
                  x_batch_bcast,
                  tuple(x.shape)[:batch_ndim],
                  y_batch_bcast,
                  tuple(y.shape)[:batch_ndim],
              )
          )
          core_shape = tuple(x.shape)[batch_ndim:]
          x = alloc(x, *batch_shape, *core_shape)
  
      new_idxs = [slice(None)] * batch_ndim + new_idxs
      symbolic_idxs = x[tuple(new_idxs)].owner.inputs[1:]
      new_out = op.core_op.make_node(x, y, *symbolic_idxs).outputs
      copy_stack_trace(node.outputs, new_out)
      return new_out
  
imports: import sys
  from collections.abc import Iterable
  import numpy
  import pytensor
  import pytensor.scalar.basic
  from pytensor import compile
  from pytensor.graph.basic import Constant, Variable
  from pytensor.graph.rewriting.basic import WalkingGraphRewriter, copy_stack_trace, in2out, node_rewriter
  from pytensor.raise_op import Assert
  from pytensor.tensor.basic import Alloc, Join, MakeVector, ScalarFromTensor, TensorFromScalar, alloc, as_tensor, cast, concatenate, extract_constant, get_underlying_scalar_constant_value, register_infer_shape, switch
  from pytensor.tensor.blockwise import Blockwise
  from pytensor.tensor.elemwise import Elemwise
  from pytensor.tensor.exceptions import NotScalarConstantError
  from pytensor.tensor.math import Dot, add, and_, ceil_intdiv, dot, eq, ge, gt, le, lt, maximum, minimum, or_
  from pytensor.tensor.math import all
  from pytensor.tensor.rewriting.basic import register_canonicalize, register_specialize, register_stabilize
  from pytensor.tensor.shape import Shape, SpecifyShape, Unbroadcast, shape_padleft, shape_tuple, specify_shape, unbroadcast
  from pytensor.tensor.sharedvar import TensorSharedVariable
  from pytensor.tensor.subtensor import AdvancedIncSubtensor, AdvancedIncSubtensor1, AdvancedSubtensor, AdvancedSubtensor1, IncSubtensor, Subtensor, advanced_inc_subtensor1, advanced_subtensor, advanced_subtensor1, as_index_constant, as_index_literal, get_canonical_form_slice, get_constant_idx, get_idx_list, get_slice_elements, inc_subtensor, indices_from_subtensor
  from pytensor.tensor.type import TensorType
  from pytensor.tensor.type_other import NoneTypeT, SliceConstant, SliceType
  from pytensor.tensor.variable import TensorConstant, TensorVariable
label_desc: Use image node_id 33 for calling a global function with example usage: local_blockwise_advanced_inc_subtensor(fgraph, node) and returns: new_out, None, None, None