Class RNNCellImpl

Inheritance Relationships

Base Type

Class Documentation

class torch::nn::RNNCellImpl : public torch::nn::detail::RNNCellImplBase<RNNCellImpl>

An Elman RNN cell with tanh or ReLU non-linearity.

See to learn about the exact behavior of this module.

See the documentation for torch::nn::RNNCellOptions class to learn what constructor arguments are supported for this module.


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

Public Functions

RNNCellImpl(int64_t input_size, int64_t hidden_size)
RNNCellImpl(const RNNCellOptions &options_)
Tensor forward(const Tensor &input, Tensor hx = {})

Public Members

RNNCellOptions options

Protected Functions

bool _forward_has_default_args() override

The following three functions allow a module with default arguments in its forward method to be used in a Sequential module.

You should NEVER override these functions manually. Instead, you should use the FORWARD_HAS_DEFAULT_ARGS macro.

unsigned int _forward_num_required_args() override
std::vector<torch::nn::AnyValue> _forward_populate_default_args(std::vector<torch::nn::AnyValue> &&arguments) override
std::string get_nonlinearity_str() const override


friend struct torch::nn::AnyModuleHolder


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