class_docstr: Dynamic 2-Dimensional Convolution layer.
  
  This implementation is based on
  https://github.com/pytorch/fairseq/tree/master/fairseq
  
  Args:
      wshare (int): the number of kernel of convolution
      n_feat (int): the number of features
      dropout_rate (float): dropout_rate
      kernel_size (int): kernel size (length)
      use_kernel_mask (bool): Use causal mask or not for convolution kernel
      use_bias (bool): Use bias term or not.
docstr: Construct Dynamic 2-Dimensional Convolution layer.
docstr_tok: ["Construct","Dynamic","2-Dimensional","Convolution","layer","."]
code: def __init__(
      self,
      wshare,
      n_feat,
      dropout_rate,
      kernel_size,
      use_kernel_mask=False,
      use_bias=False,
  ):
      """Construct Dynamic 2-Dimensional Convolution layer."""
      super(DynamicConvolution2D, self).__init__()
  
      assert n_feat % wshare == 0
      self.wshare = wshare
      self.use_kernel_mask = use_kernel_mask
      self.dropout_rate = dropout_rate
      self.kernel_size = kernel_size
      self.padding_size = int(kernel_size / 2)
      self.attn_t = None
      self.attn_f = None
  
      # linear -> GLU -- -> lightconv -> linear
      #               \        /
      #                 Linear
      self.linear1 = nn.Linear(n_feat, n_feat * 2)
      self.linear2 = nn.Linear(n_feat * 2, n_feat)
      self.linear_weight = nn.Linear(
          n_feat, self.wshare * 1 * kernel_size
      )
      nn.init.xavier_uniform_(self.linear_weight.weight)
      self.linear_weight_f = nn.Linear(n_feat, kernel_size)
      nn.init.xavier_uniform_(self.linear_weight_f.weight)
      self.act = nn.GLU()
  
      # dynamic conv related
      self.use_bias = use_bias
      if self.use_bias:
          self.bias = nn.Parameter(torch.Tensor(n_feat))
  
imports: import numpy
  import torch
  import torch.nn.functional
  from torch import nn
label_desc: Use image node_id 1 to create a new DynamicConvolution2D object from inherited base classes: nn with example: obj = DynamicConvolution2D(wshare, n_feat, dropout_rate, kernel_size, use_kernel_mask, use_bias)