code: def local_uint_constant_indices(fgraph, node):
      """Convert constant indices to unsigned dtypes."""
  
      if isinstance(
          node.op,
          (IncSubtensor, AdvancedIncSubtensor, AdvancedIncSubtensor1),
      ):
          x, y, *indices = node.inputs
      else:
          x, *indices = node.inputs
          y = None
  
      idx_list = getattr(node.op, "idx_list", None)
      new_indices = list(indices_from_subtensor(indices, idx_list))
      has_new_index = False
  
      for i, index in enumerate(new_indices):
          if not isinstance(index, Constant):
              continue
  
          index_val = index.data
  
          if index_val is None or isinstance(index_val, slice):
              # TODO: If slice index dtypes matter, we can consider converting
              # those, as well.
              continue
  
          assert isinstance(index_val, (np.generic, np.ndarray))
  
          if index_val.size == 0:
              continue
  
          if index_val.dtype == bool:
              continue
  
          if np.ndim(index_val) > 0:
              minval = index_val.min()
          else:
              minval = index_val
  
          if minval >= 0:
              maxval = index_val.max()
              dtype = np.min_scalar_type(maxval)
          else:
              # If we can't convert to unsigned, then don't attempt to minimize
              # the type size either--at least not for now.
              # dtype = np.min_scalar_type(-max(-minval, maxval))
              continue
  
          if dtype == index_val.dtype:
              continue
  
          if index_val.ndim > 0:
              new_index = pytensor.tensor.as_tensor_variable(
                  index_val.astype(dtype), dtype=dtype
              )
          else:
              new_index = ps.constant(
                  index_val.astype(dtype), dtype=dtype
              )
  
          new_indices[i] = new_index
          has_new_index = True
  
      if not has_new_index:
          return False
  
      new_out = x[tuple(new_indices)]
  
      if y is not None:
          new_out = inc_subtensor(
              new_out,
              y,
              inplace=node.op.inplace,
              set_instead_of_inc=node.op.set_instead_of_inc,
              ignore_duplicates=getattr(
                  node.op, "ignore_duplicates", False
              ),
          )
  
      new_outs = new_out.owner.outputs
      copy_stack_trace(node.outputs, new_outs)
  
      return new_outs
  
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 32 for calling a global function with example usage: local_uint_constant_indices(fgraph, node) and returns: new_outs, False