class_docstr: Transformer encoder module.
  
  Args:
      idim (int): Input dimension.
      attention_dim (int): Dimension of attention.
      attention_heads (int): The number of heads of multi head attention.
      conv_wshare (int): The number of kernel of convolution. Only used in
          selfattention_layer_type == "lightconv*" or "dynamiconv*".
      conv_kernel_length (Union[int, str]): Kernel size str of convolution
          (e.g. 71_71_71_71_71_71). Only used in selfattention_layer_type
          == "lightconv*" or "dynamiconv*".
      conv_usebias (bool): Whether to use bias in convolution. Only used in
          selfattention_layer_type == "lightconv*" or "dynamiconv*".
      linear_units (int): The number of units of position-wise feed forward.
      num_blocks (int): The number of decoder blocks.
      dropout_rate (float): Dropout rate.
      positional_dropout_rate (float): Dropout rate after adding positional encoding.
      attention_dropout_rate (float): Dropout rate in attention.
      input_layer (Union[str, torch.nn.Module]): Input layer type.
      pos_enc_class (torch.nn.Module): Positional encoding module class.
          `PositionalEncoding `or `ScaledPositionalEncoding`
      normalize_before (bool): Whether to use layer_norm before the first block.
      concat_after (bool): Whether to concat attention layer's input and output.
          if True, additional linear will be applied.
          i.e. x -> x + linear(concat(x, att(x)))
          if False, no additional linear will be applied. i.e. x -> x + att(x)
      positionwise_layer_type (str): "linear", "conv1d", or "conv1d-linear".
      positionwise_conv_kernel_size (int): Kernel size of positionwise conv1d layer.
      selfattention_layer_type (str): Encoder attention layer type.
      padding_idx (int): Padding idx for input_layer=embed.
      stochastic_depth_rate (float): Maximum probability to skip the encoder layer.
      intermediate_layers (Union[List[int], None]): indices of intermediate CTC layer.
          indices start from 1.
          if not None, intermediate outputs are returned (which changes return type
          signature.)
docstr: Define positionwise layer.
docstr_tok: ["Define","positionwise","layer","."]
code: def get_positionwise_layer(
      self,
      positionwise_layer_type="linear",
      attention_dim=256,
      linear_units=2048,
      dropout_rate=0.1,
      positionwise_conv_kernel_size=1,
  ):
      """Define positionwise layer."""
      if positionwise_layer_type == "linear":
          positionwise_layer = PositionwiseFeedForward
          positionwise_layer_args = (
              attention_dim,
              linear_units,
              dropout_rate,
          )
      elif positionwise_layer_type == "conv1d":
          positionwise_layer = MultiLayeredConv1d
          positionwise_layer_args = (
              attention_dim,
              linear_units,
              positionwise_conv_kernel_size,
              dropout_rate,
          )
      elif positionwise_layer_type == "conv1d-linear":
          positionwise_layer = Conv1dLinear
          positionwise_layer_args = (
              attention_dim,
              linear_units,
              positionwise_conv_kernel_size,
              dropout_rate,
          )
      else:
          raise NotImplementedError("Support only linear or conv1d.")
      return positionwise_layer, positionwise_layer_args
  
imports: import logging
  import torch
  from espnet.nets.pytorch_backend.nets_utils import rename_state_dict
  from espnet.nets.pytorch_backend.transducer.vgg2l import VGG2L
  from espnet.nets.pytorch_backend.transformer.attention import MultiHeadedAttention
  from espnet.nets.pytorch_backend.transformer.dynamic_conv import DynamicConvolution
  from espnet.nets.pytorch_backend.transformer.dynamic_conv2d import DynamicConvolution2D
  from espnet.nets.pytorch_backend.transformer.embedding import PositionalEncoding
  from espnet.nets.pytorch_backend.transformer.encoder_layer import EncoderLayer
  from espnet.nets.pytorch_backend.transformer.layer_norm import LayerNorm
  from espnet.nets.pytorch_backend.transformer.lightconv import LightweightConvolution
  from espnet.nets.pytorch_backend.transformer.lightconv2d import LightweightConvolution2D
  from espnet.nets.pytorch_backend.transformer.multi_layer_conv import Conv1dLinear, MultiLayeredConv1d
  from espnet.nets.pytorch_backend.transformer.positionwise_feed_forward import PositionwiseFeedForward
  from espnet.nets.pytorch_backend.transformer.repeat import repeat
  from espnet.nets.pytorch_backend.transformer.subsampling import Conv2dSubsampling, Conv2dSubsampling6, Conv2dSubsampling8
label_desc: Use image node_id 2 for calling the Encoder obj's underlying member method code with example usage: obj.get_positionwise_layer(positionwise_layer_type, attention_dim, linear_units, dropout_rate, positionwise_conv_kernel_size) and returns: positionwise_layer,  positionwise_layer_args