class_docstr: Decoder based on "Convolutional Sequence to Sequence Learning"
  :cite:`DBLP:journals/corr/GehringAGYD17`.
  
  Consists of residual convolutional layers, with ConvMultiStepAttention.
class_docstr_tok: ["Decoder","based","on","``","Convolutional","Sequence","to","Sequence","Learning","''",":","cite",":","`","DBLP",":","journals\/corr\/GehringAGYD17","`",".","Consists","of","residual","convolutional","layers",",","with","ConvMultiStepAttention","."]
docstr: Alternate constructor.
docstr_tok: ["Alternate","constructor","."]
code: def from_opt(cls, opt, embeddings):
      """Alternate constructor."""
      return cls(
          opt.dec_layers,
          opt.dec_hid_size,
          opt.global_attention,
          opt.copy_attn,
          opt.cnn_kernel_width,
          opt.dropout[0] if type(opt.dropout) is list else opt.dropout,
          embeddings,
          opt.copy_attn_type,
      )
  
file_path: OpenNMT-py/onmt/decoders/cnn_decoder.py
imports: import torch
  import torch.nn
  from onmt.modules import ConvMultiStepAttention, GlobalAttention
  from onmt.utils.cnn_factory import shape_transform, GatedConv
  from onmt.decoders.decoder import DecoderBase
label_desc: Use image node_id 2 for calling the CNNDecoder obj's underlying member method code with example usage: obj.from_opt(cls, opt, embeddings) and returns: cls