code: def mask_sequence_loss(
      logits, labels, input_length, label_length, smoothing=0.0
  ):
      """
      softmax cross entropy loss for sequence to sequence
      :param logits: [batch_size, max_seq_len, vocab_size]
      :param labels: [batch_size, max_seq_len]
      :param input_length: [batch_size]
      :param label_length: [batch_size]
      :return: loss, scalar
      """
      del smoothing
      del input_length
  
      if label_length is not None:
          weights = tf.cast(utils.len_to_mask(label_length), tf.float32)
      else:
          weights = tf.ones_like(labels)
      loss = tfa.seq2seq.loss.sequence_loss(logits, labels, weights)
      return loss
  
file_path: delta/delta/utils/loss/loss_utils.py
imports: import math
  import delta.compat
  import tensorflow_addons
  from delta import utils
  from delta.utils import ctc_utils
label_desc: Use image node_id 5 for calling a global function with example usage: mask_sequence_loss(logits, labels, input_length, label_length, smoothing) and returns: loss