Skip to main content

SimpleRecurrentLayerParams

Struct SimpleRecurrentLayerParams 

Source
pub struct SimpleRecurrentLayerParams {
    pub input_vector_size: u64,
    pub output_vector_size: u64,
    pub activation: Option<ActivationParams>,
    pub sequence_output: bool,
    pub has_bias_vector: bool,
    pub weight_matrix: Option<WeightParams>,
    pub recursion_matrix: Option<WeightParams>,
    pub bias_vector: Option<WeightParams>,
    pub reverse_input: bool,
}
Expand description

A simple recurrent layer.

.. code::

  y_t = SimpleRecurrentLayer(x_t, y_{t-1})

Input A blob of rank 5, with shape `[Seq, Batch, inputVectorSize, 1, 1]. This represents a sequence of vectors of size inputVectorSize. Output Same rank as the input. Represents a vector of size outputVectorSize``. It is either the final output or a sequence of outputs at all time steps.

  • Output Shape: \[1, Batch, outputVectorSize, 1, 1\] , if sequenceOutput == false
  • Output Shape: \[Seq, Batch, outputVectorSize, 1, 1\] , if sequenceOutput == true

This layer is described by the following equation:

.. math:: \boldsymbol{y_t} = f(\mathrm{clip}(W \boldsymbol{x_t} +
R \boldsymbol{y_{t-1}} + b))

  • W is a 2-dimensional weight matrix (\[outputVectorSize, inputVectorSize\], row-major)
  • R is a 2-dimensional recursion matrix (\[outputVectorSize, outputVectorSize\], row-major)
  • b is a 1-dimensional bias vector (\[outputVectorSize\])
  • f() is an activation
  • clip() is a function that constrains values between \[-50.0, 50.0\]

Fields§

§input_vector_size: u64

The size of the input vectors.

§output_vector_size: u64

The size of the output vectors.

§activation: Option<ActivationParams>

Activations supported are Linear, Sigmoid, Tanh, ReLU, Scaled Tanh (alpha = 1.71, beta = 2/3), Hard sigmoid (alpha = 0.2, beta = 0.5)

The activation function.

§sequence_output: bool

If false output is just the result after final state update. If true, output is a sequence, containing outputs at all time steps.

§has_bias_vector: bool

If false, no bias is added.

§weight_matrix: Option<WeightParams>

Weight matrix W.

§recursion_matrix: Option<WeightParams>

Recursion Weight matrix R.

§bias_vector: Option<WeightParams>

Bias vector b.

§reverse_input: bool

If true, then the node processes the input sequence from right to left

Trait Implementations§

Source§

impl Clone for SimpleRecurrentLayerParams

Source§

fn clone(&self) -> SimpleRecurrentLayerParams

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SimpleRecurrentLayerParams

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SimpleRecurrentLayerParams

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Message for SimpleRecurrentLayerParams

Source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
Source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
Source§

fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message to a buffer. Read more
Source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
Source§

fn encode_length_delimited( &self, buf: &mut impl BufMut, ) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
Source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
Source§

fn decode(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes an instance of the message from a buffer. Read more
Source§

fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes a length-delimited instance of the message from the buffer.
Source§

fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
Source§

fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
Source§

impl PartialEq for SimpleRecurrentLayerParams

Source§

fn eq(&self, other: &SimpleRecurrentLayerParams) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for SimpleRecurrentLayerParams

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.