code: def test_shift_adamax(backend_default):
      shiftadamax = ShiftAdaMax()
      param = np.random.rand(200, 128)
      param2 = copy.deepcopy(param)
      grad = 0.01 * np.random.rand(200, 128)
      grad2 = grad / 128.0
      states = [
          0.01 * np.random.rand(200, 128),
          0.01 * np.random.rand(200, 128),
          0.01 * np.random.rand(200, 128),
      ]
      states2 = [copy.deepcopy(states[0]), copy.deepcopy(states[1])]
      epoch = 1
      t = epoch + 1
      l = shiftadamax.learning_rate / (1 - shiftadamax.beta_1**t)
      m, v = states2
      m[:] = m * shiftadamax.beta_1 + (1.0 - shiftadamax.beta_1) * grad2
      v[:] = np.maximum(v * shiftadamax.beta_2, np.absolute(grad2))
      inv_v = np.random.rand(200, 128)
      inv_v[:] = 1.0 / (v + shiftadamax.epsilon)
  
      def safelog(left):
          return np.log(np.maximum(left, np.exp(-50.0)))
  
      def shift(ary, shift_ary):
          exp = np.rint(safelog(np.absolute(shift_ary)) / np.log(2))
          ap2 = np.multiply(np.sign(shift_ary), np.exp2(exp))
          return np.multiply(ary, ap2)
  
      param2[:] = param2 - shift(shift(m, inv_v), l)
      np.clip(param2, -1, 1, param2)
      param_list = [
          (
              (wrap(param), wrap(grad)),
              [wrap(states[0]), wrap(states[1]), wrap(states[2])],
          )
      ]
  
      try:
          compare_tensors(
              shiftadamax, param_list, param2, tol=1e-4, epoch=epoch
          )
      except:
          # xfail for gpu backend on maxwell or kepler
          if not isinstance(NervanaObject.be, NervanaGPU):
              compare_tensors(
                  shiftadamax, param_list, param2, tol=1e-4, epoch=epoch
              )
          else:
              if os.getenv("PLATFORM"):
                  platform = os.getenv("PLATFORM")
              else:
                  if os.path.exists("/usr/bin/nvidia-smi"):
                      cmd = "/usr/bin/nvidia-smi -q | grep \"Product Name\" | tail -1 | cut -f 2 -d ':' | \
                             cut -f 2- -d ' '"
                      gpu_info = subp.check_output(cmd, shell=True)
                  else:
                      gpu_info = "unknown"
  
              if (
                  gpu_info == "GeForce GTX TITAN X\n"
                  or b"GeForce GTX TITAN X\n"
              ):
                  platform = "TITANX"
              elif (
                  gpu_info == "GeForce GTX 1080\n"
                  or b"GeForce GTX 1080\n"
              ):
                  platform = "GTX1080"
              else:
                  platform = "unknown"
  
              if platform == "TITANX" or platform == "GTX1080":
                  pytest.xfail(
                      reason="xfail issue #1040 with {} PLATFORM".format(
                          platform
                      )
                  )
              else:
                  compare_tensors(
                      shiftadamax,
                      param_list,
                      param2,
                      tol=1e-4,
                      epoch=epoch,
                  )
  
imports: import os
  import pytest
  import subprocess
  import numpy
  import copy
  from neon import NervanaObject
  from neon.backends import gen_backend
  from neon.optimizers import GradientDescentMomentum, RMSProp, Adadelta, Adam, Adagrad, ShiftAdaMax
  from neon.optimizers import MultiOptimizer
  from neon.layers import Conv, Affine, LSTM, GRU
  from neon.layers.layer import ParameterLayer
  from neon.initializers import Gaussian, Constant
  from neon.transforms import Rectlin, Logistic, Tanh
label_desc: Use image node_id 15 for calling a global function with example usage: test_shift_adamax(backend_default) and returns: np, np