Class RNNImpl¶
Defined in File rnn.h
Page Contents
Inheritance Relationships¶
Base Type¶
public torch::nn::detail::RNNImplBase< RNNImpl >
(Template Class RNNImplBase)
Class Documentation¶
-
class RNNImpl : public torch::nn::detail::RNNImplBase<RNNImpl>¶
A multi-layer Elman RNN module with Tanh or ReLU activation.
See https://pytorch.org/docs/main/generated/torch.nn.RNN.html to learn about the exact behavior of this module.
See the documentation for
torch::nn::RNNOptions
class to learn what constructor arguments are supported for this module.Example:
RNN model(RNNOptions(128, 64).num_layers(3).dropout(0.2).nonlinearity(torch::kTanh));
Public Functions
-
inline RNNImpl(int64_t input_size, int64_t hidden_size)¶
-
explicit RNNImpl(const RNNOptions &options_)¶
-
std::tuple<Tensor, Tensor> forward(const Tensor &input, Tensor hx = {})¶
-
std::tuple<torch::nn::utils::rnn::PackedSequence, Tensor> forward_with_packed_input(const torch::nn::utils::rnn::PackedSequence &packed_input, Tensor hx = {})¶
Public Members
-
RNNOptions options¶
Protected Functions
-
inline virtual 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.
-
inline virtual unsigned int _forward_num_required_args() override¶
-
inline std::vector<torch::nn::AnyValue> _forward_populate_default_args(std::vector<torch::nn::AnyValue> &&arguments) override¶
-
std::tuple<Tensor, Tensor> forward_helper(const Tensor &input, const Tensor &batch_sizes, const Tensor &sorted_indices, int64_t max_batch_size, Tensor hx)¶
Friends
- friend struct torch::nn::AnyModuleHolder
-
inline RNNImpl(int64_t input_size, int64_t hidden_size)¶