class_docstr: Encoder based on "Convolutional Sequence to Sequence Learning"
  :cite:`DBLP:journals/corr/GehringAGYD17`.
docstr: Alternate constructor.
code: def from_opt(cls, opt, embeddings):
      """Alternate constructor."""
      return cls(
          opt.enc_layers,
          opt.enc_hid_size,
          opt.cnn_kernel_width,
          opt.dropout[0] if type(opt.dropout) is list else opt.dropout,
          embeddings,
      )
  
file_path: OpenNMT-py/onmt/encoders/cnn_encoder.py
imports: import torch.nn
  from onmt.encoders.encoder import EncoderBase
  from onmt.utils.cnn_factory import shape_transform, StackedCNN
label_desc: Use image node_id 2 for calling the CNNEncoder obj's underlying member method code with example usage: obj.from_opt(cls, opt, embeddings) and returns: cls