class_docstr: Gated convolution for CNN class
class_docstr_tok: ["Gated","convolution","for","CNN","class"]
code: def __init__(self, input_size, width=3, dropout=0.2, nopad=False):
      super(GatedConv, self).__init__()
      self.conv = onmt.modules.WeightNormConv2d(
          input_size,
          2 * input_size,
          kernel_size=(width, 1),
          stride=(1, 1),
          padding=(width // 2 * (1 - nopad), 0),
      )
      # this param init is overridden by model_builder, useless then.
      init.xavier_uniform_(
          self.conv.weight, gain=(4 * (1 - dropout)) ** 0.5
      )
      self.dropout = nn.Dropout(dropout)
  
file_path: OpenNMT-py/onmt/utils/cnn_factory.py
imports: import torch
  import torch.nn
  import torch.nn.init
  import onmt.modules
label_desc: Use image node_id 1 to create a new GatedConv object from inherited base classes: nn with example: obj = GatedConv(input_size, width, dropout, nopad)