code: def test_sparsemax_of_to_inf(dtype):
      """check sparsemax proposition 1, part 2."""
      random = np.random.RandomState(4)
  
      z = random.uniform(low=-3, high=3, size=(test_obs, 10))
  
      # assume |A(z)| = 1, as z is continues random
      z_sort_arg = np.argsort(z, axis=1)[:, ::-1]
      z_sort = np.sort(z, axis=-1)[:, ::-1]
      gamma_z = z_sort[:, 0] - z_sort[:, 1]
      epsilon = (0.99 * gamma_z * 1).reshape(-1, 1)
  
      # construct the expected 1_A(z) array
      p_expected = np.zeros((test_obs, 10), dtype=dtype)
      p_expected[np.arange(0, test_obs), z_sort_arg[:, 0]] = 1
  
      tf_sparsemax_out = sparsemax(((1 / epsilon) * z).astype(dtype))
  
      test_utils.assert_allclose_according_to_type(
          p_expected, tf_sparsemax_out
      )
  
file_path: addons/tensorflow_addons/activations/tests/sparsemax_test.py
imports: import pytest
  import numpy
  import tensorflow
  from tensorflow_addons.activations import sparsemax
  from tensorflow_addons.utils import test_utils
label_desc: Use image node_id 9 for calling a global function with example usage: test_sparsemax_of_to_inf(dtype) without return types