(opt, embeddings)
Various encoder dispatcher function.
    Args:
        opt: the option in current environment.
        embeddings (Embeddings): vocab embeddings for this encoder.
Various encoder dispatcher function.
    Args:
        opt: the option in current environment.
        embeddings (Embeddings): vocab embeddings for this encoder.
Various encoder dispatcher function . Args : opt : the option in current environment . embeddings ( Embeddings ) : vocab embeddings for this encoder .
def build_encoder(opt, embeddings):
    """
    Various encoder dispatcher function.
    Args:
        opt: the option in current environment.
        embeddings (Embeddings): vocab embeddings for this encoder.
    """
    if opt.encoder_type == "transformer":
        # return TransformerEncoder(opt.enc_layers, opt.rnn_size,
        #                           opt.heads, opt.transformer_ff,
        #                           opt.dropout, embeddings)
        return None
    elif opt.encoder_type == "cnn":
        return CNNEncoder(opt.enc_layers, opt.rnn_size,
                          opt.cnn_kernel_width,
                          opt.dropout, embeddings)
    elif opt.encoder_type == "mean":
        return MeanEncoder(opt.enc_layers, embeddings)
    else:
        # "rnn" or "brnn"
        return RNNEncoder(opt.rnn_type, opt.brnn, opt.enc_layers,
                          opt.rnn_size, opt.dropout, embeddings,
                          opt.bridge)
def build_encoder ( opt , embeddings ) : if opt . encoder_type == "transformer" : # return TransformerEncoder(opt.enc_layers, opt.rnn_size, #                           opt.heads, opt.transformer_ff, #                           opt.dropout, embeddings) return None elif opt . encoder_type == "cnn" : return CNNEncoder ( opt . enc_layers , opt . rnn_size , opt . cnn_kernel_width , opt . dropout , embeddings ) elif opt . encoder_type == "mean" : return MeanEncoder ( opt . enc_layers , embeddings ) else : # "rnn" or "brnn" return RNNEncoder ( opt . rnn_type , opt . brnn , opt . enc_layers , opt . rnn_size , opt . dropout , embeddings , opt . bridge )