class_docstr: Convolutional 1D subsampling (to 1/2 length).
  
  Args:
      idim (int): Input dimension.
      odim (int): Output dimension.
      dropout_rate (float): Dropout rate.
      pos_enc (torch.nn.Module): Custom position encoding layer.
class_docstr_tok: ["Convolutional","1D","subsampling","(","to","1\/2","length",")",".","Args",":","idim","(","int",")",":","Input","dimension",".","odim","(","int",")",":","Output","dimension",".","dropout_rate","(","float",")",":","Dropout","rate",".","pos_enc","(","torch.nn.Module",")",":","Custom","position","encoding","layer","."]
docstr: Subsample x.
  
  Args:
      x (torch.Tensor): Input tensor (#batch, time, idim).
      x_mask (torch.Tensor): Input mask (#batch, 1, time).
  
  Returns:
      torch.Tensor: Subsampled tensor (#batch, time', odim),
          where time' = time // 2.
      torch.Tensor: Subsampled mask (#batch, 1, time'),
          where time' = time // 2.
code: def forward(self, x, x_mask):
      """Subsample x.
  
      Args:
          x (torch.Tensor): Input tensor (#batch, time, idim).
          x_mask (torch.Tensor): Input mask (#batch, 1, time).
  
      Returns:
          torch.Tensor: Subsampled tensor (#batch, time', odim),
              where time' = time // 2.
          torch.Tensor: Subsampled mask (#batch, 1, time'),
              where time' = time // 2.
  
      """
      x = x.transpose(2, 1)  # (#batch, idim, time)
      x = self.conv(x)
      b, c, t = x.size()
      x = self.out(x.transpose(1, 2).contiguous())
      if x_mask is None:
          return x, None
      return x, x_mask[:, :, :-2:1][:, :, :-2:2]
  
imports: import torch
  from espnet.nets.pytorch_backend.transformer.embedding import PositionalEncoding
label_desc: Use image node_id 2 for calling the Conv1dSubsampling2 obj's underlying member method code with example usage: obj.forward(x, x_mask) and returns: x,  x_mask, x,  None