Struct TransformerOptions¶
Defined in File transformer.h
Page Contents
Struct Documentation¶
-
struct
torch::nn
::
TransformerOptions
¶ Options for the
Transformer
module.Example:
TransformerOptions options; TransformerOptions options(16, 4); auto options = TransformerOptions().d_model(4).nhead(2).dropout(0.0);
Public Functions
-
TransformerOptions
() = default¶
-
TransformerOptions
(int64_t d_model, int64_t nhead)¶
-
TransformerOptions
(int64_t d_model, int64_t nhead, int64_t num_encoder_layers, int64_t num_decoder_layers)¶
-
auto
d_model
(const int64_t &new_d_model) -> decltype(*this)¶ the number of expected features in the encoder/decoder inputs (default=512)
-
auto
d_model
(int64_t &&new_d_model) -> decltype(*this)¶
-
const int64_t &
d_model
() const noexcept¶
-
int64_t &
d_model
() noexcept¶
-
auto
nhead
(const int64_t &new_nhead) -> decltype(*this)¶ the number of heads in the multiheadattention models (default=8)
-
auto
nhead
(int64_t &&new_nhead) -> decltype(*this)¶
-
const int64_t &
nhead
() const noexcept¶
-
int64_t &
nhead
() noexcept¶
-
auto
num_encoder_layers
(const int64_t &new_num_encoder_layers) -> decltype(*this)¶ the number of sub-encoder-layers in the encoder (default=6)
-
auto
num_encoder_layers
(int64_t &&new_num_encoder_layers) -> decltype(*this)¶
-
const int64_t &
num_encoder_layers
() const noexcept¶
-
int64_t &
num_encoder_layers
() noexcept¶
-
auto
num_decoder_layers
(const int64_t &new_num_decoder_layers) -> decltype(*this)¶ the number of sub-decoder-layers in the decoder (default=6)
-
auto
num_decoder_layers
(int64_t &&new_num_decoder_layers) -> decltype(*this)¶
-
const int64_t &
num_decoder_layers
() const noexcept¶
-
int64_t &
num_decoder_layers
() noexcept¶
-
auto
dim_feedforward
(const int64_t &new_dim_feedforward) -> decltype(*this)¶ the dimension of the feedforward network model (default=2048)
-
auto
dim_feedforward
(int64_t &&new_dim_feedforward) -> decltype(*this)¶
-
const int64_t &
dim_feedforward
() const noexcept¶
-
int64_t &
dim_feedforward
() noexcept¶
-
auto
dropout
(const double &new_dropout) -> decltype(*this)¶ the dropout value (default=0.1)
-
auto
dropout
(double &&new_dropout) -> decltype(*this)¶
-
const double &
dropout
() const noexcept¶
-
double &
dropout
() noexcept¶
-
auto
activation
(const activation_t &new_activation) -> decltype(*this)¶ the activation function of encoder/decoder intermediate layer (default=
torch::kReLU
)
-
auto
activation
(activation_t &&new_activation) -> decltype(*this)¶
-
const activation_t &
activation
() const noexcept¶
-
activation_t &
activation
() noexcept¶
-
auto
custom_encoder
(const AnyModule &new_custom_encoder) -> decltype(*this)¶ custom encoder (default=None)
-