code: def test_sparsemax_loss_zero(dtype):
      """check sparsemax-loss proposition 5."""
      random = np.random.RandomState(6)
  
      # construct z and q, such that z_k >= 1 + max_{j!=k} z_k holds for
      # delta_0 = 1.
      z = random.uniform(low=-3, high=3, size=(test_obs, 10))
      z[:, 0] = np.max(z, axis=1) + 1.05
  
      q = np.zeros((test_obs, 10))
      q[:, 0] = 1
  
      tf_loss_op, tf_loss_out = _tf_sparsemax_loss(z, q, dtype)
  
      tf_sparsemax_op = sparsemax(z.astype(dtype))
  
      test_utils.assert_allclose_according_to_type(
          np.zeros(test_obs), tf_loss_out
      )
      assert np.zeros(test_obs).shape == tf_loss_op.shape
  
      test_utils.assert_allclose_according_to_type(q, tf_sparsemax_op)
      assert q.shape == tf_sparsemax_op.shape
  
file_path: addons/tensorflow_addons/losses/tests/sparsemax_loss_test.py
imports: import pytest
  from packaging.version import Version
  import tensorflow
  import numpy
  from tensorflow_addons.activations import sparsemax
  from tensorflow_addons.losses import sparsemax_loss, SparsemaxLoss
  from tensorflow_addons.utils import test_utils
label_desc: Use image node_id 12 for calling a global function with example usage: test_sparsemax_loss_zero(dtype) without return types