code: def numpy_maxandargmax(X, axis=None):
      if axis is None:
          axis = list(range(X.ndim))
      elif not isinstance(axis, (tuple, list)):
          axis = [int(axis)]
      axis = list(set(axis))  # remove duplicated values.
      axis.sort()
      axis = tuple(axis)
      ref_max = np.max(X, axis=axis)
      # Following code is copied from MaxAndArgmax.perform():
      # Numpy does not support multiple axes for argmax. Work around.
      keep_axes = np.array(
          [i for i in range(X.ndim) if i not in axis], dtype="int64"
      )
      # Not-reduced axes in front
      transposed_x = np.transpose(X, np.concatenate((keep_axes, axis)))
      kept_shape = transposed_x.shape[: len(keep_axes)]
      reduced_shape = transposed_x.shape[len(keep_axes) :]
      new_shape = kept_shape + (np.prod(reduced_shape),)
      new_shape = tuple(int(i) for i in new_shape)
      reshaped_x = transposed_x.reshape(new_shape)
      return (ref_max, np.argmax(reshaped_x, axis=-1))
  
imports: from __future__ import print_function, absolute_import, division
  from unittest import TestCase
  import numpy
  import theano
  import theano.tensor
  from theano.tests import unittest_tools
  from theano.tests.unittest_tools import SkipTest
  from .config import mode_with_gpu, mode_without_gpu
  from .test_basic_ops import rand_gpuarray
  from ..None import GpuArrayType
  from ..reduction import GpuMaxAndArgmax
  from ..dnn import GpuDnnReduction
  import math
label_desc: Use image node_id 2 for calling a global function with example usage: numpy_maxandargmax(X, axis) and returns: ref_max,  np