class_docstr: Conv1d module definition.
  
  Args:
      input_size: Input dimension.
      output_size: 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.
      causal: Whether to use causal convolution (set to True if streaming).
      dropout_rate: Dropout rate.
docstr: Encode input sequences.
  
  Args:
      x: Conv1d input sequences. (B, T, D_in)
      pos_enc: Positional embedding sequences. (B, 2 * (T - 1), D_in)
      mask: Source mask. (B, T)
      chunk_mask: Chunk mask. (T_2, T_2)
  
  Returns:
      x: Conv1d output sequences. (B, sub(T), D_out)
      mask: Source mask. (B, T) or (B, sub(T))
      pos_enc: Positional embedding sequences.
                 (B, 2 * (T - 1), D_att) or (B, 2 * (sub(T) - 1), D_out)
docstr_tok: ["Encode","input","sequences",".","Args",":","x",":","Conv1d","input","sequences",".","(","B",",","T",",","D_in",")","pos_enc",":","Positional","embedding","sequences",".","(","B",",","2","*","(","T","-","1",")",",","D_in",")","mask",":","Source","mask",".","(","B",",","T",")","chunk_mask",":","Chunk","mask",".","(","T_2",",","T_2",")","Returns",":","x",":","Conv1d","output","sequences",".","(","B",",","sub","(","T",")",",","D_out",")","mask",":","Source","mask",".","(","B",",","T",")","or","(","B",",","sub","(","T",")",")","pos_enc",":","Positional","embedding","sequences",".","(","B",",","2","*","(","T","-","1",")",",","D_att",")","or","(","B",",","2","*","(","sub","(","T",")","-","1",")",",","D_out",")"]
code: def forward(
      self,
      x: torch.Tensor,
      pos_enc: torch.Tensor,
      mask: Optional[torch.Tensor] = None,
      chunk_mask: Optional[torch.Tensor] = None,
  ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
      """Encode input sequences.
  
      Args:
          x: Conv1d input sequences. (B, T, D_in)
          pos_enc: Positional embedding sequences. (B, 2 * (T - 1), D_in)
          mask: Source mask. (B, T)
          chunk_mask: Chunk mask. (T_2, T_2)
  
      Returns:
          x: Conv1d output sequences. (B, sub(T), D_out)
          mask: Source mask. (B, T) or (B, sub(T))
          pos_enc: Positional embedding sequences.
                     (B, 2 * (T - 1), D_att) or (B, 2 * (sub(T) - 1), D_out)
  
      """
      x = x.transpose(1, 2)
  
      if self.lorder > 0:
          x = torch.nn.functional.pad(
              x, (self.lorder, 0), "constant", 0.0
          )
      else:
          mask = self.create_new_mask(mask)
          pos_enc = self.create_new_pos_enc(pos_enc)
  
      x = self.conv(x)
  
      if self.batch_norm:
          x = self.bn(x)
  
      x = self.dropout(x)
  
      if self.relu:
          x = self.relu_func(x)
  
      x = x.transpose(1, 2)
  
      return x, mask, self.out_pos(pos_enc)
  
file_path: espnet/espnet2/asr_transducer/encoder/blocks/conv1d.py
imports: from typing import Optional, Tuple, Union
  import torch
label_desc: Use image node_id 3 for calling the Conv1d obj's underlying member method code with example usage: obj.forward(x, pos_enc, mask, chunk_mask) and returns: x,  mask,  self