revise RNN spec (#8081)

* revise RNN spec

Signed-off-by: fishbell <bell.song@intel.com>

* formatting the formula

Signed-off-by: fishbell <bell.song@intel.com>

* Update docs/ops/sequence/RNNSequence_5.md

Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>

Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>
This commit is contained in:
song, bell 2021-11-23 04:12:37 -05:00 committed by GitHub
parent 24675fd8ea
commit f06aa9955b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View File

@ -6,6 +6,18 @@
**Short description**: *RNNCell* represents a single RNN cell that computes the output using the formula described in the [article](https://hackernoon.com/understanding-architecture-of-lstm-cell-from-scratch-with-code-8da40f0b71f4).
**Detailed description**:
*RNNCell* represents a single RNN cell and is part of [RNNSequence](RNNSequence_5.md) operation.
```
Formula:
* - matrix multiplication
^T - matrix transpose
f - activation function
Ht = f(Xt*(Wi^T) + Ht-1*(Ri^T) + Wbi + Rbi)
```
**Attributes**
* *hidden_size*
@ -43,7 +55,7 @@
* **1**: `X` - 2D tensor of type *T* `[batch_size, input_size]`, input data. **Required.**
* **2**: `initial_hidden_state` - 2D tensor of type *T* `[batch_size, hidden_size]`. **Required.**
* **2**: `H` - 2D tensor of type *T* `[batch_size, hidden_size]`, initial hidden state. **Required.**
* **3**: `W` - 2D tensor tensor of type *T* `[hidden_size, input_size]`, the weights for matrix multiplication. **Required.**

View File

@ -46,7 +46,7 @@ A single cell in the sequence is implemented in the same way as in <a href="#RNN
* *direction*
* **Description**: Specify if the RNN is forward, reverse, or bidirectional. If it is one of *forward* or *reverse* then `num_directions = 1`, if it is *bidirectional*, then `num_directions = 2`. This `num_directions` value specifies input/output shape requirements.
* **Description**: Specify if the RNN is forward, reverse, or bidirectional. If it is one of *forward* or *reverse*, then `num_directions = 1`. If it is *bidirectional*, then `num_directions = 2`. This `num_directions` value specifies input/output shape requirements. When the operation is bidirectional, the input goes through forward and reverse ways. The outputs are concatenated.
* **Range of values**: *forward*, *reverse*, *bidirectional*
* **Type**: `string`
* **Required**: *yes*
@ -55,7 +55,7 @@ A single cell in the sequence is implemented in the same way as in <a href="#RNN
* **1**: `X` - 3D tensor of type *T1* `[batch_size, seq_length, input_size]`, input data. It differs from RNNCell 1st input only by additional axis with size `seq_length`. **Required.**
* **2**: `initial_hidden_state` - 3D tensor of type *T1* `[batch_size, num_directions, hidden_size]`, input hidden state data. **Required.**
* **2**: `H` - 3D tensor of type *T1* `[batch_size, num_directions, hidden_size]`, input hidden state data. **Required.**
* **3**: `sequence_lengths` - 1D tensor of type *T2* `[batch_size]`, specifies real sequence lengths for each batch element. **Required.**