Shortcuts

Struct TransformerDecoderOptions

Page Contents

Struct Documentation

struct torch::nn::TransformerDecoderOptions

Options for the TransformerDecoder module.

Example:

TransformerDecoderLayer decoder_layer(TransformerDecoderLayerOptions(512, 8).dropout(0.1));
auto options = TransformerDecoderOptions(decoder_layer, 6)norm(LayerNorm(LayerNormOptions({2})));
TransformerDecoder transformer_decoder(options);

Public Functions

TransformerDecoderOptions(TransformerDecoderLayer decoder_layer, int64_t num_layers)
TransformerDecoderOptions(const TransformerDecoderLayerOptions &decoder_layer_options, int64_t num_layers)
auto decoder_layer(const TransformerDecoderLayer &new_decoder_layer) -> decltype(*this)

decoder layer to be cloned

auto decoder_layer(TransformerDecoderLayer &&new_decoder_layer) -> decltype(*this)
const TransformerDecoderLayer &decoder_layer() const noexcept
TransformerDecoderLayer &decoder_layer() noexcept
auto num_layers(const int64_t &new_num_layers) -> decltype(*this)

number of decoder 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