class_docstr: CTC-attention hybrid Encoder-Decoder model
class_docstr_tok: ["CTC-attention","hybrid","Encoder-Decoder","model"]
docstr: Compute Transducer loss.
  
  Args:
      encoder_out: Encoder output sequences. (B, T, D_enc)
      encoder_out_lens: Encoder output sequences lengths. (B,)
      labels: Label ID sequences. (B, L)
  
  Return:
      loss_transducer: Transducer loss value.
      cer_transducer: Character error rate for Transducer.
      wer_transducer: Word Error Rate for Transducer.
docstr_tok: ["Compute","Transducer","loss",".","Args",":","encoder_out",":","Encoder","output","sequences",".","(","B",",","T",",","D_enc",")","encoder_out_lens",":","Encoder","output","sequences","lengths",".","(","B",",",")","labels",":","Label","ID","sequences",".","(","B",",","L",")","Return",":","loss_transducer",":","Transducer","loss","value",".","cer_transducer",":","Character","error","rate","for","Transducer",".","wer_transducer",":","Word","Error","Rate","for","Transducer","."]
code: def _calc_transducer_loss(
      self,
      encoder_out: torch.Tensor,
      encoder_out_lens: torch.Tensor,
      labels: torch.Tensor,
  ):
      """Compute Transducer loss.
  
      Args:
          encoder_out: Encoder output sequences. (B, T, D_enc)
          encoder_out_lens: Encoder output sequences lengths. (B,)
          labels: Label ID sequences. (B, L)
  
      Return:
          loss_transducer: Transducer loss value.
          cer_transducer: Character error rate for Transducer.
          wer_transducer: Word Error Rate for Transducer.
  
      """
      decoder_in, target, t_len, u_len = get_transducer_task_io(
          labels,
          encoder_out_lens,
          ignore_id=self.ignore_id,
          blank_id=self.blank_id,
      )
  
      self.decoder.set_device(encoder_out.device)
      decoder_out = self.decoder(decoder_in)
  
      joint_out = self.joint_network(
          encoder_out.unsqueeze(2), decoder_out.unsqueeze(1)
      )
  
      loss_transducer = self.criterion_transducer(
          joint_out,
          target,
          t_len,
          u_len,
      )
  
      cer_transducer, wer_transducer = None, None
      if not self.training and self.error_calculator_trans is not None:
          cer_transducer, wer_transducer = self.error_calculator_trans(
              encoder_out, target
          )
  
      return loss_transducer, cer_transducer, wer_transducer
  
imports: import logging
  from contextlib import contextmanager
  from typing import Dict, List, Optional, Tuple, Union
  import torch
  from packaging.version import parse
  from typeguard import check_argument_types
  from espnet2.asr.ctc import CTC
  from espnet2.asr.decoder.abs_decoder import AbsDecoder
  from espnet2.asr.encoder.abs_encoder import AbsEncoder
  from espnet2.asr.frontend.abs_frontend import AbsFrontend
  from espnet2.asr.postencoder.abs_postencoder import AbsPostEncoder
  from espnet2.asr.preencoder.abs_preencoder import AbsPreEncoder
  from espnet2.asr.specaug.abs_specaug import AbsSpecAug
  from espnet2.asr.transducer.error_calculator import ErrorCalculatorTransducer
  from espnet2.asr_transducer.utils import get_transducer_task_io
  from espnet2.layers.abs_normalize import AbsNormalize
  from espnet2.torch_utils.device_funcs import force_gatherable
  from espnet2.train.abs_espnet_model import AbsESPnetModel
  from espnet.nets.e2e_asr_common import ErrorCalculator
  from espnet.nets.pytorch_backend.nets_utils import th_accuracy
  from espnet.nets.pytorch_backend.transformer.add_sos_eos import add_sos_eos
  from espnet.nets.pytorch_backend.transformer.label_smoothing_loss import LabelSmoothingLoss
label_desc: Use image node_id 10 for calling the ESPnetASRModel obj's underlying member method code with example usage: obj._calc_transducer_loss(encoder_out, encoder_out_lens, labels) and returns: loss_transducer,  cer_transducer,  wer_transducer