Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[res] Add recipe for Decomposed GRU #14251

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

chunseoklee
Copy link
Contributor

@chunseoklee chunseoklee commented Oct 24, 2024

This PR adds recipe for decomposed GRU(This recipe will be used for validating --fuse_gru pass in circle2circle)

draft : #14237
issue : #12263

ONE-DCO-1.0-Signed-off-by: Artem Balyshev [email protected]
ONE-DCO-1.0-Signed-off-by: Chunseok Lee [email protected]

This PR adds recipe for decomposed GRU(This recipe will be used for
validating --fuse_gru pass in circle2circle)

ONE-DCO-1.0-Signed-off-by: Artem Balyshev <[email protected]>
ONE-DCO-1.0-Signed-off-by: Chunseok Lee <[email protected]>
@chunseoklee
Copy link
Contributor Author

chunseoklee commented Oct 24, 2024

tflchef generated tflite as follow :

gru_tflchef.zip

* Below diagram shows GRU pattern to fuse.
 * Note: this pattern for GRU with `return_sequences=False`
 * - the below pattern will be replaced with one GRU
 *  Main Graph:
 *           [In]    [CircleConst]    [CircleConst]    [CircleConst]    [CircleConst]
 *            |             |              |                |                 |
 *            V             |              |                |                 |
 *         [CircleWhile]<-----------------------------------------------------
 *            |
 *            V
 *      [CircleWhileOut]
 *            |
 *            V
 *          [Out]
 *
 * Condition Graph:
 *          [In]   [CircleConst] (scalar int32 value)
 *           |        |
 *           V        |
 *         [Less]------
 *           |
 *           V
 *         [Out]
 *
 *  Body Graph must contain:
 *  - 2 CircleFullyConnected nodes;
 *  - 3 CircleMul nodes;
 *  - 2 CircleLogistic nodes;
 *  - 2 CircleSplit nodes;
 *  - 6 CircleAdd nodes;
 *  - 1 CircleGather node;
 *  - 1 CircleReshape node;
 *  - 1 CircleSub node;
 *  - 1 CircleTanh node;
 *  - 6 CircleSplitOut nodes;
 *  - 5 CircleInput nodes;
 *  - 5 CircleOutput nodes;
 *
 *  Body Graph:
 *  [In_1]                     [In_2]--->[Add_2 (with Const)]--->[Out_2]            [In_3]
 *    |    \                                                      |                   |
 *    |     \                                         [In_4]---[Gather]      [Add_3 (with Const)]
 *    |     [FullyConnected_1]                          |         |                   |
 *    |               |                              [Out_4]      |                [Out_3]
 *    |           [Split_1]                                 [FullyConnected_2]
 *    |         /         |   \                                       |
 *    |        |          |    \                                   [Split_2]
 *    |    [Add_1] -------+----+---------------------------------/    |     |
 *    |         |         |    |                                      |     |
 *    |         |         |    ------------------------------------[Add_4]  |
 *    |         |         |                                           |     |
 *    |         |         |                                   [Logistic_1]  |
 *    |         |         |                                          |      |
 *    |         |         ----------------------------------------[Mul_2]   |
 *    |         |                                                    \      /
 *    |         |                                                     [Add_5]
 *    |         |                                                        |
 *    |      [Logistic_2]                                              [Tanh]
 *     \     /           \                                               |
 *      [Mul_1]          [Sub (with const)]                              |
 *       \                                 \                             |
 *        \                                 ---------------------------[Mul_3]
 *         \                                                           /
 *          \                                                         /
 *           --------------------[Add_6]------------------------------
 *                              /     \
 *                             /       \
 *                         [Reshape]   [Out_5]
 *                             |
 *                           [Out_1]

Copy link
Contributor

@seanshpark seanshpark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@seanshpark seanshpark merged commit 153edec into Samsung:master Oct 24, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants