code: def testNpSoftmax(self):
      features = [[1.0, 1.0, 1.0, 1.0], [1.0, 2.0, 3.0, 4.0]]
      # Batch 0: All exps are 1.  The expected result is
      # Softmaxes = [0.25, 0.25, 0.25, 0.25]
      # LogSoftmaxes = [-1.386294, -1.386294, -1.386294, -1.386294]
      #
      # Batch 1:
      # exps = [1., 2.718, 7.389, 20.085]
      # sum = 31.192
      # Softmaxes = exps / sum = [0.0320586, 0.08714432, 0.23688282, 0.64391426]
      # LogSoftmaxes = [-3.44019 , -2.44019 , -1.44019 , -0.44019]
      np_sm = self._npSoftmax(np.array(features))
      self.assertAllClose(
          np.array(
              [
                  [0.25, 0.25, 0.25, 0.25],
                  [0.0320586, 0.08714432, 0.23688282, 0.64391426],
              ]
          ),
          np_sm,
          rtol=1.0e-5,
          atol=1.0e-5,
      )
      np_lsm = self._npSoftmax(np.array(features), log=True)
      self.assertAllClose(
          np.array(
              [
                  [-1.386294, -1.386294, -1.386294, -1.386294],
                  [-3.4401897, -2.4401897, -1.4401897, -0.4401897],
              ]
          ),
          np_lsm,
          rtol=1.0e-5,
          atol=1.0e-5,
      )
  
imports: import unittest
  import numpy
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.platform import test
  from tensorflow.python.platform import tf_logging
label_desc: Use image node_id 4 for calling the SoftmaxTest obj's underlying member method code with example usage: obj.testNpSoftmax() without return types