Documentation
¶
Index ¶
- type SimpleRNN
- func (r *SimpleRNN[T]) Attributes() map[string]interface{}
- func (r *SimpleRNN[T]) Backward(ctx context.Context, mode types.BackwardMode, ...) ([]*tensor.TensorNumeric[T], error)
- func (r *SimpleRNN[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
- func (r *SimpleRNN[T]) OpType() string
- func (r *SimpleRNN[T]) OutputShape() []int
- func (r *SimpleRNN[T]) Parameters() []*graph.Parameter[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SimpleRNN ¶
SimpleRNN is a simple recurrent neural network layer. It maintains a hidden state that is updated at each forward pass. newState = tanh(Wx*x + Wh*h + b)
func NewSimpleRNN ¶
func NewSimpleRNN[T tensor.Numeric]( name string, engine compute.Engine[T], ops numeric.Arithmetic[T], inputDim, hiddenDim int, ) (*SimpleRNN[T], error)
NewSimpleRNN creates a new SimpleRNN layer.
func (*SimpleRNN[T]) Attributes ¶
Attributes returns the attributes of the layer.
func (*SimpleRNN[T]) Backward ¶
func (r *SimpleRNN[T]) Backward(ctx context.Context, mode types.BackwardMode, outputGradient *tensor.TensorNumeric[T], inputs ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)
Backward computes the gradients.
func (*SimpleRNN[T]) Forward ¶
func (r *SimpleRNN[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
Forward performs the forward pass. It takes one input: the current input to the sequence. The hidden state is managed internally.
func (*SimpleRNN[T]) OutputShape ¶
OutputShape returns the output shape of the layer.
func (*SimpleRNN[T]) Parameters ¶
Parameters returns the trainable parameters of the layer.
Click to show internal directories.
Click to hide internal directories.