Shortcuts

Struct TransformerEncoderOptions

Page Contents

Struct Documentation

struct torch::nn::TransformerEncoderOptions

Options for the TransformerEncoder

Example:

TransformerEncoderLayer encoderLayer(TransformerEncoderLayerOptions(512, 8).dropout(0.1));
auto options = TransformerEncoderOptions(encoderLayer, 6).norm(LayerNorm(LayerNormOptions({2})));

Public Functions

TransformerEncoderOptions(TransformerEncoderLayer encoder_layer, int64_t num_layers)
TransformerEncoderOptions(const TransformerEncoderLayerOptions &encoder_layer_options, int64_t num_layers)
auto encoder_layer(const TransformerEncoderLayer &new_encoder_layer) -> decltype(*this)

transformer Encoder Layer

auto encoder_layer(TransformerEncoderLayer &&new_encoder_layer) -> decltype(*this)
const TransformerEncoderLayer &encoder_layer() const noexcept
TransformerEncoderLayer &encoder_layer() noexcept
auto num_layers(const int64_t &new_num_layers) -> decltype(*this)

number of encoder layers

auto num_layers(int64_t &&new_num_layers) -> decltype(*this)
const int64_t &num_layers() const noexcept
int64_t &num_layers() noexcept
auto norm(const AnyModule &new_norm) -> decltype(*this)

normalization module

auto norm(AnyModule &&new_norm) -> decltype(*this)
const AnyModule &norm() const noexcept
AnyModule &norm() noexcept

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources