code: def numba_funcify_Alloc(op, node, **kwargs):
      global_env = {"np": np, "to_scalar": numba_basic.to_scalar}
  
      unique_names = unique_name_generator(
          [
              "np",
              "to_scalar",
              "alloc",
              "val_np",
              "val",
              "scalar_shape",
              "res",
          ],
          suffix_sep="_",
      )
      shape_var_names = [
          unique_names(v, force_unique=True) for v in node.inputs[1:]
      ]
      shape_var_item_names = [
          f"{name}_item" for name in shape_var_names
      ]
      shapes_to_items_src = indent(
          "\n".join(
              [
                  f"{item_name} = to_scalar({shape_name})"
                  for item_name, shape_name in zip(
                      shape_var_item_names, shape_var_names
                  )
              ]
          ),
          " " * 4,
      )
  
      check_runtime_broadcast = []
      for i, val_static_dim in enumerate(
          node.inputs[0].type.shape[::-1]
      ):
          if val_static_dim is None:
              check_runtime_broadcast.append(
                  f'if val.shape[{-i - 1}] == 1 and scalar_shape[{-i - 1}] != 1: raise ValueError("{Alloc._runtime_broadcast_error_msg}")'
              )
      check_runtime_broadcast_src = indent(
          "\n".join(check_runtime_broadcast), " " * 4
      )
  
      alloc_def_src = f"""
  def alloc(val, {", ".join(shape_var_names)}):
      val_np = np.asarray(val)
  {shapes_to_items_src}
      scalar_shape = {create_tuple_string(shape_var_item_names)}
  {check_runtime_broadcast_src}
      res = np.empty(scalar_shape, dtype=val_np.dtype)
      res[...] = val_np
      return res
      """
      alloc_fn = compile_function_src(
          alloc_def_src, "alloc", {**globals(), **global_env}
      )
  
      return numba_basic.numba_njit(alloc_fn)
  
file_path: pytensor/pytensor/link/numba/dispatch/tensor_basic.py
imports: from textwrap import indent
  import numpy
  from pytensor.link.numba.dispatch import basic
  from pytensor.link.numba.dispatch.basic import create_tuple_string, numba_funcify
  from pytensor.link.utils import compile_function_src, unique_name_generator
  from pytensor.tensor.basic import Alloc, AllocEmpty, ARange, ExtractDiag, Eye, Join, MakeVector, ScalarFromTensor, Split, TensorFromScalar
  from pytensor.tensor.shape import Unbroadcast
label_desc: Use image node_id 2 for calling a global function with example usage: numba_funcify_Alloc(op, node) and returns: numba_basic