code: def test_case_small(
      self, device, k2_is_appropriate, k2_cuda_is_enabled
  ):
      skip_test_if_unsupported(
          device, k2_is_appropriate, k2_cuda_is_enabled
      )
  
      acts = np.array(
          [
              [
                  [
                      [0.1, 0.6, 0.1, 0.1, 0.1],
                      [0.1, 0.1, 0.6, 0.1, 0.1],
                      [0.1, 0.1, 0.2, 0.8, 0.1],
                  ],
                  [
                      [0.1, 0.6, 0.1, 0.1, 0.1],
                      [0.1, 0.1, 0.2, 0.1, 0.1],
                      [0.7, 0.1, 0.2, 0.1, 0.1],
                  ],
              ]
          ]
      )
      labels = [[1, 2]]
  
      fn_k2 = init_k2_rnnt(
          num_classes=acts.shape[-1], blank=0, reduction="sum"
      )
      k2_cost, k2_grads = wrap_and_call(fn_k2, acts, labels, device)
  
      expected_cost = 4.495666
      expected_grads = np.array(
          [
              [
                  [
                      [
                          -0.13116688,
                          -0.3999269,
                          0.17703125,
                          0.17703125,
                          0.17703125,
                      ],
                      [
                          -0.18572757,
                          0.12247056,
                          -0.18168412,
                          0.12247056,
                          0.12247056,
                      ],
                      [
                          -0.32091254,
                          0.06269141,
                          0.06928472,
                          0.12624499,
                          0.06269141,
                      ],
                  ],
                  [
                      [
                          0.05456069,
                          -0.21824276,
                          0.05456069,
                          0.05456069,
                          0.05456069,
                      ],
                      [
                          0.12073959,
                          0.12073959,
                          -0.48295835,
                          0.12073959,
                          0.12073959,
                      ],
                      [
                          -0.6925882,
                          0.16871116,
                          0.18645467,
                          0.16871116,
                          0.16871116,
                      ],
                  ],
              ]
          ]
      )
  
      assert np.allclose(
          k2_cost, expected_cost, rtol=1e-6
      ), "small_test costs mismatch."
      assert np.allclose(
          k2_grads, expected_grads, atol=1e-6
      ), "small_test gradient mismatch."
  
file_path: NeMo/tests/collections/asr/k2/test_rnnt.py
imports: import numpy
  import pytest
  import torch
  from nemo.collections.asr.parts.numba.rnnt_loss.rnnt_numpy import RNNTLoss
label_desc: Use image node_id 1 for calling the TestRNNTLossK2 obj's underlying member method code with example usage: obj.test_case_small(device, k2_is_appropriate, k2_cuda_is_enabled) without return types