class_docstr: 1D convolution module for custom encoder.
  
  Args:
      idim: Input dimension.
      odim: Output dimension.
      kernel_size: Size of the convolving kernel.
      stride: Stride of the convolution.
      dilation: Spacing between the kernel points.
      groups: Number of blocked connections from input channels to output channels.
      bias: Whether to add a learnable bias to the output.
      batch_norm: Whether to use batch normalization after convolution.
      relu: Whether to use a ReLU activation after convolution.
      dropout_rate: Dropout rate.
docstr: Forward ConvEncoderLayer module object.
  
  Args:
      sequence: Input sequences.
                (B, T, D_in)
                  or (B, T, D_in),  (B, 2 * (T - 1), D_att)
      mask: Mask of input sequences. (B, 1, T)
  
  Returns:
      sequence: Output sequences.
                (B, sub(T), D_out)
                  or (B, sub(T), D_out),  (B, 2 * (sub(T) - 1), D_att)
      mask: Mask of output sequences. (B, 1, sub(T))
code: def forward(
      self,
      sequence: Union[torch.Tensor, Tuple[torch.Tensor, torch.Tensor]],
      mask: torch.Tensor,
  ) -> Tuple[
      Union[torch.Tensor, Tuple[torch.Tensor, torch.Tensor]],
      torch.Tensor,
  ]:
      """Forward ConvEncoderLayer module object.
  
      Args:
          sequence: Input sequences.
                    (B, T, D_in)
                      or (B, T, D_in),  (B, 2 * (T - 1), D_att)
          mask: Mask of input sequences. (B, 1, T)
  
      Returns:
          sequence: Output sequences.
                    (B, sub(T), D_out)
                      or (B, sub(T), D_out),  (B, 2 * (sub(T) - 1), D_att)
          mask: Mask of output sequences. (B, 1, sub(T))
  
      """
      if isinstance(sequence, tuple):
          sequence, pos_embed = sequence[0], sequence[1]
      else:
          sequence, pos_embed = sequence, None
  
      sequence = sequence.transpose(1, 2)
      sequence = self.conv(sequence)
  
      if self.batch_norm:
          sequence = self.bn(sequence)
  
      sequence = self.dropout(sequence)
  
      if self.relu:
          sequence = self.relu_func(sequence)
  
      sequence = sequence.transpose(1, 2)
  
      mask = self.create_new_mask(mask)
  
      if pos_embed is not None:
          pos_embed = self.create_new_pos_embed(pos_embed)
  
          return (sequence, pos_embed), mask
  
      return sequence, mask
  
file_path: espnet/espnet/nets/pytorch_backend/transducer/conv1d_nets.py
imports: from typing import Optional, Tuple, Union
  import torch
label_desc: Use image node_id 2 for calling the Conv1d obj's underlying member method code with example usage: obj.forward(sequence, mask) and returns: sequence,  mask, sequence,  pos_embed,  mask