code: def numba_funcify_MaxAndArgmax(op, node, **kwargs):
      axis = op.axis
      x_at = node.inputs[0]
      x_dtype = x_at.type.numpy_dtype
      x_dtype = numba.np.numpy_support.from_dtype(x_dtype)
      x_ndim = x_at.ndim
  
      if x_ndim == 0:
  
          @numba_basic.numba_njit(inline="always")
          def maxandargmax(x):
              return x, 0
  
      else:
          axes = tuple(int(ax) for ax in axis)
  
          # NumPy does not support multiple axes for argmax; this is a
          # work-around
          keep_axes = tuple(i for i in range(x_ndim) if i not in axes)
  
          reduce_max_py_fn = create_multiaxis_reducer(
              scalar_maximum,
              -np.inf,
              axes,
              x_ndim,
              x_dtype,
              return_scalar=False,
          )
          reduce_max = jit_compile_reducer(
              Apply(node.op, node.inputs, [node.outputs[0].clone()]),
              reduce_max_py_fn,
              reduce_to_scalar=False,
          )
  
          reduced_x_ndim = x_ndim - len(axes) + 1
          argmax_axis = create_axis_apply_fn(
              np.argmax, reduced_x_ndim - 1, reduced_x_ndim, np.int64
          )
  
          reaxis_order = keep_axes + axes
          sl1 = slice(None, len(keep_axes))
          sl2 = slice(len(keep_axes), None)
  
          @numba_basic.numba_njit
          def maxandargmax(x):
              max_res = reduce_max(x)
  
              # Not-reduced axes in front
              transposed_x = np.ascontiguousarray(
                  np.transpose(x, reaxis_order)
              )
              kept_shape = transposed_x.shape[sl1]
              reduced_shape = transposed_x.shape[sl2]
              reduced_size = 1
              for s in reduced_shape:
                  reduced_size *= s
  
              # Numpy.prod returns 1.0 when arg is empty, so we cast it to int64
              # Otherwise reshape would complain citing float arg
              new_shape = kept_shape + (reduced_size,)
              reshaped_x = transposed_x.reshape(new_shape)
  
              max_idx_res = argmax_axis(reshaped_x)
  
              return max_res, max_idx_res
  
      return maxandargmax
  
imports: import base64
  import pickle
  from functools import singledispatch
  from numbers import Number
  from textwrap import indent
  from typing import Any, Callable, Optional, Union
  import numba
  import numpy
  from numba import TypingError, types
  from numba.core import cgutils
  from numba.core.extending import overload
  from numba.np import arrayobj
  from numpy.core.numeric import normalize_axis_index, normalize_axis_tuple
  from pytensor import config
  from pytensor.graph.basic import Apply
  from pytensor.graph.op import Op
  from pytensor.link.numba.dispatch import basic
  from pytensor.link.numba.dispatch import elemwise_codegen
  from pytensor.link.numba.dispatch.basic import create_numba_signature, create_tuple_creator, numba_funcify, numba_njit, use_optimized_cheap_pass
  from pytensor.link.utils import compile_function_src, get_name_for_object
  from pytensor.scalar.basic import AND, OR, XOR, Add, Composite, IntDiv, Mean, Mul, ScalarMaximum, ScalarMinimum, Sub, TrueDiv, scalar_maximum
  from pytensor.scalar.basic import add
  from pytensor.tensor.elemwise import CAReduce, DimShuffle, Elemwise
  from pytensor.tensor.math import MaxAndArgmax, MulWithoutZeros, Sum
  from pytensor.tensor.special import LogSoftmax, Softmax, SoftmaxGrad
  from pytensor.tensor.type import scalar
label_desc: Use image node_id 27 for calling a global function with example usage: numba_funcify_MaxAndArgmax(op, node) and returns: maxandargmax, x,  int, max_res,  max_idx_res