Trait opencv::dnn::RNNLayerTrait

source ·
pub trait RNNLayerTrait: LayerTrait + RNNLayerTraitConst {
    // Required method
    fn as_raw_mut_RNNLayer(&mut self) -> *mut c_void;

    // Provided methods
    fn set_weights(
        &mut self,
        wxh: &impl MatTraitConst,
        bh: &impl MatTraitConst,
        whh: &impl MatTraitConst,
        who: &impl MatTraitConst,
        bo: &impl MatTraitConst
    ) -> Result<()> { ... }
    fn set_produce_hidden_output(&mut self, produce: bool) -> Result<()> { ... }
    fn set_produce_hidden_output_def(&mut self) -> Result<()> { ... }
}
Expand description

Mutable methods for crate::dnn::RNNLayer

Required Methods§

Provided Methods§

source

fn set_weights( &mut self, wxh: &impl MatTraitConst, bh: &impl MatTraitConst, whh: &impl MatTraitConst, who: &impl MatTraitConst, bo: &impl MatTraitConst ) -> Result<()>

Setups learned weights.

Recurrent-layer behavior on each step is defined by current input @f$ x_t @f$, previous state @f$ h_t @f$ and learned weights as follows: @f{eqnarray*}{ h_t &= tanh&(W_{hh} h_{t-1} + W_{xh} x_t + b_h), \ o_t &= tanh&(W_{ho} h_t + b_o), @f}

§Parameters
  • Wxh: is @f$ W_{xh} @f$ matrix
  • bh: is @f$ b_{h} @f$ vector
  • Whh: is @f$ W_{hh} @f$ matrix
  • Who: is @f$ W_{xo} @f$ matrix
  • bo: is @f$ b_{o} @f$ vector
source

fn set_produce_hidden_output(&mut self, produce: bool) -> Result<()>

If this flag is set to true then layer will produce @f$ h_t @f$ as second output. @details Shape of the second output is the same as first output.

§C++ default parameters
  • produce: false
source

fn set_produce_hidden_output_def(&mut self) -> Result<()>

If this flag is set to true then layer will produce @f$ h_t @f$ as second output. @details Shape of the second output is the same as first output.

§Note

This alternative version of RNNLayerTrait::set_produce_hidden_output function uses the following default values for its arguments:

  • produce: false

Object Safety§

This trait is not object safe.

Implementors§