code: def test_optimization(self):
      # If we use only the max output, we should replace this op with
      # a faster one.
      mode = theano.compile.mode.get_default_mode().including(
          "canonicalize", "fast_run"
      )
  
      for axis in [0, 1, -1]:
          data = np.asarray(np.random.rand(2, 3), dtype=config.floatX)
          n = tensor.matrix()
  
          f = function(
              [n], tensor.max_and_argmax(n, axis)[0], mode=mode
          )
          topo = f.maker.fgraph.toposort()
          assert len(topo) == 1
          assert isinstance(topo[0].op, CAReduce)
  
          f = function([n], tensor.max_and_argmax(n, axis), mode=mode)
          topo = f.maker.fgraph.toposort()
          assert len(topo) == 1
          assert isinstance(topo[0].op, tensor.MaxAndArgmax)
  
imports: from __future__ import absolute_import, print_function, division
  import unittest
  import numpy
  import theano
  from theano import function, config
  from theano import scalar
  from theano.gof import FunctionGraph
  from theano.gof.opt import out2in
  from theano.tensor.opt_uncanonicalize import local_alloc_dimshuffle, local_reshape_dimshuffle, local_dimshuffle_alloc, local_dimshuffle_subtensor
  import theano.tensor
  from theano.tensor.elemwise import CAReduce, Elemwise, DimShuffle
  from theano.tests import unittest_tools
label_desc: Use image node_id 1 for calling the T_max_and_argmax obj's underlying member method code with example usage: obj.test_optimization() without return types