Shortcuts

Struct RNNOptionsBase

Page Contents

Struct Documentation

struct RNNOptionsBase

Common options for RNN, LSTM and GRU modules.

Public Types

typedef std::variant<enumtype::kLSTM, enumtype::kGRU, enumtype::kRNN_TANH, enumtype::kRNN_RELU> rnn_options_base_mode_t

Public Functions

RNNOptionsBase(rnn_options_base_mode_t mode, int64_t input_size, int64_t hidden_size)
inline auto mode(const rnn_options_base_mode_t &new_mode) -> decltype(*this)
inline auto mode(rnn_options_base_mode_t &&new_mode) -> decltype(*this)
inline const rnn_options_base_mode_t &mode() const noexcept
inline rnn_options_base_mode_t &mode() noexcept
inline auto input_size(const int64_t &new_input_size) -> decltype(*this)

The number of features of a single sample in the input sequence x.

inline auto input_size(int64_t &&new_input_size) -> decltype(*this)
inline const int64_t &input_size() const noexcept
inline int64_t &input_size() noexcept
inline auto hidden_size(const int64_t &new_hidden_size) -> decltype(*this)

The number of features in the hidden state h.

inline auto hidden_size(int64_t &&new_hidden_size) -> decltype(*this)
inline const int64_t &hidden_size() const noexcept
inline int64_t &hidden_size() noexcept
inline auto num_layers(const int64_t &new_num_layers) -> decltype(*this)

The number of recurrent layers (cells) to use.

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 bias(const bool &new_bias) -> decltype(*this)

Whether a bias term should be added to all linear operations.

inline auto bias(bool &&new_bias) -> decltype(*this)
inline const bool &bias() const noexcept
inline bool &bias() noexcept
inline auto batch_first(const bool &new_batch_first) -> decltype(*this)

If true, the input sequence should be provided as (batch, sequence, features).

If false (default), the expected layout is (sequence, batch, features).

inline auto batch_first(bool &&new_batch_first) -> decltype(*this)
inline const bool &batch_first() const noexcept
inline bool &batch_first() noexcept
inline auto dropout(const double &new_dropout) -> decltype(*this)

If non-zero, adds dropout with the given probability to the output of each RNN layer, except the final layer.

inline auto dropout(double &&new_dropout) -> decltype(*this)
inline const double &dropout() const noexcept
inline double &dropout() noexcept
inline auto bidirectional(const bool &new_bidirectional) -> decltype(*this)

Whether to make the RNN bidirectional.

inline auto bidirectional(bool &&new_bidirectional) -> decltype(*this)
inline const bool &bidirectional() const noexcept
inline bool &bidirectional() noexcept
inline auto proj_size(const int64_t &new_proj_size) -> decltype(*this)

Cell projection dimension.

If 0, projections are not added. Can only be used for LSTMs.

inline auto proj_size(int64_t &&new_proj_size) -> decltype(*this)
inline const int64_t &proj_size() const noexcept
inline int64_t &proj_size() 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