code: def _ctc_loss_v3(
      labels, logits, label_length, logit_length, use_gpu, sparse=True
  ):
      with test_util.device(use_gpu=use_gpu):
          if sparse:
              labels = ctc_ops.dense_labels_to_sparse(
                  labels, label_length
              )
          with backprop.GradientTape() as t:
              t.watch(logits)
              ref_loss = ctc_ops.ctc_loss_v3(
                  labels=labels,
                  logits=logits,
                  label_length=label_length,
                  logit_length=logit_length,
                  blank_index=0,
              )
          ref_grad = t.gradient(ref_loss, logits)
          return ref_loss, ref_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 3 for calling a global function with example usage: _ctc_loss_v3(labels, logits, label_length, logit_length, use_gpu, sparse) and returns: ref_loss,  ref_grad