Struct RNNCellOptions

Page Contents

Struct Documentation

struct torch::nn::RNNCellOptions

Options for the RNNCell module.


RNNCell model(RNNCellOptions(20, 10).bias(false).nonlinearity(torch::kReLU));

Public Types

typedef c10::variant<enumtype::kTanh, enumtype::kReLU> nonlinearity_t

Public Functions

RNNCellOptions(int64_t input_size, int64_t hidden_size)
auto input_size(const int64_t &new_input_size) -> decltype(*this)

The number of expected features in the input x

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

The number of features in the hidden state h

auto hidden_size(int64_t &&new_hidden_size) -> decltype(*this)
const int64_t &hidden_size() const noexcept
int64_t &hidden_size() noexcept
auto bias(const bool &new_bias) -> decltype(*this)

If false, then the layer does not use bias weights b_ih and b_hh.

Default: true

auto bias(bool &&new_bias) -> decltype(*this)
const bool &bias() const noexcept
bool &bias() noexcept
auto nonlinearity(const nonlinearity_t &new_nonlinearity) -> decltype(*this)

The non-linearity to use. Can be either torch::kTanh or torch::kReLU. Default: torch::kTanh

auto nonlinearity(nonlinearity_t &&new_nonlinearity) -> decltype(*this)
const nonlinearity_t &nonlinearity() const noexcept
nonlinearity_t &nonlinearity() noexcept


Access comprehensive developer documentation for PyTorch

View Docs


Get in-depth tutorials for beginners and advanced developers

View Tutorials


Find development resources and get your questions answered

View Resources