class_docstr: Linear encoder module.
  
  Args:
      input_size: input dim
      output_size: dimension of attention
      linear_units: the number of units of position-wise feed forward
      dropout_rate: dropout rate
      input_layer: input layer type
      normalize_before: whether to use layer_norm before the first block
      padding_idx: padding_idx for input_layer=embed
docstr: Embed positions in tensor.
  
  Args:
      xs_pad: input tensor (B, L, D)
      ilens: input length (B)
      prev_states: Not to be used now.
  Returns:
      position embedded tensor and mask
code: def forward(
      self,
      xs_pad: torch.Tensor,
      ilens: torch.Tensor,
      prev_states: torch.Tensor = None,
  ) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]:
      """Embed positions in tensor.
  
      Args:
          xs_pad: input tensor (B, L, D)
          ilens: input length (B)
          prev_states: Not to be used now.
      Returns:
          position embedded tensor and mask
      """
      masks = (~make_pad_mask(ilens)[:, None, :]).to(xs_pad.device)
  
      if self.embed is None:
          xs_pad = xs_pad
      elif (
          isinstance(self.embed, Conv2dSubsampling)
          or isinstance(self.embed, Conv2dSubsampling2)
          or isinstance(self.embed, Conv2dSubsampling6)
          or isinstance(self.embed, Conv2dSubsampling8)
      ):
          short_status, limit_size = check_short_utt(
              self.embed, xs_pad.size(1)
          )
          if short_status:
              raise TooShortUttError(
                  f"has {xs_pad.size(1)} frames and is too short for subsampling "
                  + f"(it needs more than {limit_size} frames), return empty results",
                  xs_pad.size(1),
                  limit_size,
              )
          xs_pad, masks = self.embed(xs_pad, masks)
      else:
          xs_pad = self.embed(xs_pad)
  
      if self.normalize_before:
          xs_pad = self.after_norm(xs_pad)
  
      olens = masks.squeeze(1).sum(1)
      return xs_pad, olens, None
  
file_path: espnet/espnet2/asr/encoder/linear_encoder.py
imports: from typing import List, Optional, Tuple
  import torch
  from typeguard import check_argument_types
  from espnet2.asr.encoder.abs_encoder import AbsEncoder
  from espnet.nets.pytorch_backend.nets_utils import make_pad_mask
  from espnet.nets.pytorch_backend.transformer.layer_norm import LayerNorm
  from espnet.nets.pytorch_backend.transformer.subsampling import Conv2dSubsampling, Conv2dSubsampling2, Conv2dSubsampling6, Conv2dSubsampling8, TooShortUttError, check_short_utt
label_desc: Use image node_id 3 for calling the LinearEncoder obj's underlying member method code with example usage: obj.forward(xs_pad, ilens, prev_states) and returns: xs_pad,  olens,  None