code: def _testCTCLoss(
      self,
      inputs,
      seq_lens,
      labels,
      loss_truth,
      grad_truth,
      expected_err_re=None,
  ):
      self.assertEqual(len(inputs), len(grad_truth))
  
      inputs_t = constant_op.constant(inputs)
  
      with self.cached_session(use_gpu=False) as sess:
          loss = _ctc_loss_v2(
              inputs=inputs_t, labels=labels, sequence_length=seq_lens
          )
          grad = gradients_impl.gradients(loss, [inputs_t])[0]
  
          self.assertShapeEqual(loss_truth, loss)
          self.assertShapeEqual(grad_truth, grad)
  
          if expected_err_re is None:
              (tf_loss, tf_grad) = self.evaluate([loss, grad])
              self.assertAllClose(tf_loss, loss_truth, atol=1e-6)
              self.assertAllClose(tf_grad, grad_truth, atol=1e-6)
          else:
              with self.assertRaisesOpError(expected_err_re):
                  self.evaluate([loss, grad])
  
imports: from absl.testing import parameterized
  import numpy
  from tensorflow.python.eager import backprop
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import random_seed
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import tensor_spec
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import ctc_ops
  from tensorflow.python.ops import gradients_impl
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import random_ops
  from tensorflow.python.ops import sparse_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 1 for calling the CTCLossTest obj's underlying member method code with example usage: obj._testCTCLoss(inputs, seq_lens, labels, loss_truth, grad_truth, expected_err_re) without return types