Class cv::dnn::RNNLayer#
Classical recurrent layer. View details
#include <opencv2/dnn/all_layers.hpp>Collaboration diagram for cv::dnn::RNNLayer:
Public Member Functions#
Public Member Functions inherited from cv::dnn::Layer
Return |
Name |
Description |
|---|---|---|
Initializes only name, type and blobs fields. |
||
|
||
|
||
|
||
|
||
|
|
Computes and sets internal parameters according to inputs, outputs and blobs. |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
|
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
|
|
Computes and sets internal parameters according to inputs, outputs and blobs. |
|
|
Given the input blobs, computes the output blobs. |
|
|
Given the input blobs, computes the output blobs. |
|
Given the input blobs, computes the output blobs. |
|
|
||
|
||
|
||
|
Returns parameters of layers with channel-wise multiplication and addition. |
|
|
Returns scale and zeropoint of layers. |
|
|
||
|
Returns a CANN backend node. |
|
|
Returns a CUDA backend node. |
|
|
||
|
Returns a TimVX backend node. |
|
|
||
|
||
|
Returns index of input blob into the input array. |
|
|
||
|
Returns index of output blob in output array. |
|
|
Allocates layer and computes output. |
|
|
Tries to attach to the layer the subsequent activation layer, i.e. do the layer fusion in a partial case. |
|
|
Initializes only name, type and blobs fields. |
|
|
Ask layer if it support specific backend for doing computations. |
|
|
Try to fuse current layer with a next one. |
|
|
“Detaches” all the layers, attached to particular layer. |
|
|
Public Member Functions inherited from cv::Algorithm
Return |
Name |
Description |
|---|---|---|
|
Clears the algorithm state. |
|
|
Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. |
|
|
Reads algorithm parameters from a file storage. |
|
|
||
|
|
|
|
Stores algorithm parameters in a file storage. |
|
|
Static Public Member Functions#
Static Public Member Functions inherited from cv::Algorithm
Return |
Name |
Description |
|---|---|---|
|
|
Loads algorithm from the file. |
|
|
Loads algorithm from a String. |
|
Reads algorithm from the file node. |
Public Attributes#
Public Attributes inherited from cv::dnn::Layer
Return |
Name |
Description |
|---|---|---|
|
List of learned parameters must be stored here to allow read them by using Net::getParam(). |
|
|
||
Name of the layer instance, can be used for logging or other internal purposes. |
||
|
||
|
||
|
prefer target for layer forwarding |
|
Type name which was used for creating layer by layer factory. |
Additional Inherited Members#
Protected Member Functions inherited from cv::Algorithm
Return |
Name |
Description |
|---|---|---|
|
Detailed Description#
Classical recurrent layer.
Accepts two inputs \(x_t\) and \(h_{t-1}\) and compute two outputs \(o_t\) and \(h_t\).
input: should contain packed input \(x_t\).
output: should contain output \(o_t\) (and \(h_t\) if setProduceHiddenOutput() is set to true).
input[0] should have shape [T, N, data_dims] where T and N is number of timestamps and number of independent samples of \(x_t\) respectively.
output[0] will have shape [T, N, \(N_o\)], where \(N_o\) is number of rows in \( W_{xo} \) matrix.
If setProduceHiddenOutput() is set to true then output[1] will contain a Mat with shape [T, N, \(N_h\)], where \(N_h\) is number of rows in \( W_{hh} \) matrix.
Member Function Documentation#
create()#
static Ptr< RNNLayer > cv::dnn::RNNLayer::create(const LayerParams & params)
Creates instance of RNNLayer
setWeights()#
void cv::dnn::RNNLayer::setWeights(
const Mat & Wxh,
const Mat & bh,
const Mat & Whh,
const Mat & Who,
const Mat & bo )
Setups learned weights.
Recurrent-layer behavior on each step is defined by current input \( x_t \), previous state \( h_t \) and learned weights as follows: \begin{eqnarray*} h_t &= tanh&(W_{hh} h_{t-1} + W_{xh} x_t + b_h), \ o_t &= tanh&(W_{ho} h_t + b_o), \end{eqnarray*}
Parameters
Wxh— is \( W_{xh} \) matrixbh— is \( b_{h} \) vectorWhh— is \( W_{hh} \) matrixWho— is \( W_{xo} \) matrixbo— is \( b_{o} \) vector
Source file#
The documentation for this class was generated from the following file:
opencv2/dnn/all_layers.hpp