class_docstr: Loss function module for CBHG.
class_docstr_tok: ["Loss","function","module","for","CBHG","."]
docstr: Calculate forward propagation.
  
  Args:
      cbhg_outs (Tensor): Batch of CBHG outputs (B, Lmax, spc_dim).
      spcs (Tensor): Batch of groundtruth of spectrogram (B, Lmax, spc_dim).
      olens (LongTensor): Batch of the lengths of each sequence (B,).
  
  Returns:
      Tensor: L1 loss value
      Tensor: Mean square error loss value.
docstr_tok: ["Calculate","forward","propagation",".","Args",":","cbhg_outs","(","Tensor",")",":","Batch","of","CBHG","outputs","(","B",",","Lmax",",","spc_dim",")",".","spcs","(","Tensor",")",":","Batch","of","groundtruth","of","spectrogram","(","B",",","Lmax",",","spc_dim",")",".","olens","(","LongTensor",")",":","Batch","of","the","lengths","of","each","sequence","(","B",",",")",".","Returns",":","Tensor",":","L1","loss","value","Tensor",":","Mean","square","error","loss","value","."]
code: def forward(self, cbhg_outs, spcs, olens):
      """Calculate forward propagation.
  
      Args:
          cbhg_outs (Tensor): Batch of CBHG outputs (B, Lmax, spc_dim).
          spcs (Tensor): Batch of groundtruth of spectrogram (B, Lmax, spc_dim).
          olens (LongTensor): Batch of the lengths of each sequence (B,).
  
      Returns:
          Tensor: L1 loss value
          Tensor: Mean square error loss value.
  
      """
      # perform masking for padded values
      if self.use_masking:
          mask = make_non_pad_mask(olens).unsqueeze(-1).to(spcs.device)
          spcs = spcs.masked_select(mask)
          cbhg_outs = cbhg_outs.masked_select(mask)
  
      # calculate loss
      cbhg_l1_loss = F.l1_loss(cbhg_outs, spcs)
      cbhg_mse_loss = F.mse_loss(cbhg_outs, spcs)
  
      return cbhg_l1_loss, cbhg_mse_loss
  
file_path: espnet/espnet/nets/pytorch_backend/tacotron2/cbhg.py
imports: import torch
  import torch.nn.functional
  from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
  from espnet.nets.pytorch_backend.nets_utils import make_non_pad_mask
label_desc: Use image node_id 2 for calling the CBHGLoss obj's underlying member method code with example usage: obj.forward(cbhg_outs, spcs, olens) and returns: cbhg_l1_loss,  cbhg_mse_loss