Shortcuts

Struct TransformerEncoderOptions

Page Contents

Struct Documentation

struct 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)
inline auto encoder_layer(const TransformerEncoderLayer &new_encoder_layer) -> decltype(*this)

transformer Encoder Layer

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

number of encoder layers

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

normalization module

inline auto norm(AnyModule &&new_norm) -> decltype(*this)
inline const AnyModule &norm() const noexcept
inline 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