code: def local_max_and_argmax(fgraph, node):
      """
      If we don't use the argmax, change it to a max only.
      """
      if isinstance(node.op, MaxAndArgmax):
          axis = node.op.axis
          if len(fgraph.clients[node.outputs[1]]) == 0:
              new = Max(axis)(node.inputs[0])
              copy_stack_trace(node.outputs[0], new)
              return [new, None]
  
          if len(fgraph.clients[node.outputs[0]]) == 0:
              new = Argmax(axis)(node.inputs[0])
              copy_stack_trace(node.outputs[0], new)
              return [None, new]
  
file_path: pytensor/pytensor/tensor/rewriting/uncanonicalize.py
imports: from pytensor import scalar
  from pytensor.graph.rewriting.basic import copy_stack_trace, node_rewriter
  from pytensor.tensor.basic import Alloc, alloc, constant
  from pytensor.tensor.elemwise import CAReduce, DimShuffle
  from pytensor.tensor.math import Argmax, Max, MaxAndArgmax, Min, neg
  from pytensor.tensor.rewriting.basic import register_uncanonicalize
  from pytensor.tensor.shape import Reshape, reshape
  from pytensor.tensor.subtensor import Subtensor
label_desc: Use image node_id 1 for calling a global function with example usage: local_max_and_argmax(fgraph, node) and returns: list, list