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, 3]]
  
      fn_k2 = init_k2_ctc(
          num_classes=acts.shape[-1], blank=0, reduction="sum"
      )
      k2_cost, k2_grads = wrap_and_call(fn_k2, acts, labels, device)
  
      expected_cost = 5.0279555
      expected_grads = np.array(
          [
              [
                  [
                      0.00157518,
                      -0.53266853,
                      0.17703111,
                      0.17703111,
                      0.17703111,
                  ],
                  [
                      -0.02431531,
                      -0.17048728,
                      -0.15925968,
                      0.17703113,
                      0.17703113,
                  ],
                  [
                      -0.06871005,
                      0.03236287,
                      -0.2943067,
                      0.16722652,
                      0.16342735,
                  ],
                  [
                      -0.09178554,
                      0.25313747,
                      -0.17673965,
                      -0.16164337,
                      0.17703108,
                  ],
                  [
                      -0.10229809,
                      0.19587973,
                      0.05823242,
                      -0.34769377,
                      0.19587973,
                  ],
                  [
                      -0.22203964,
                      0.1687112,
                      0.18645471,
                      -0.30183747,
                      0.1687112,
                  ],
              ]
          ]
      )
  
      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_ctc.py
imports: import numpy
  import pytest
  import torch
  from torch.nn import CTCLoss
label_desc: Use image node_id 1 for calling the TestCTCLossK2 obj's underlying member method code with example usage: obj.test_case_small(device, k2_is_appropriate, k2_cuda_is_enabled) without return types