Fixed transformation to pull constants into Loop body#4591
Merged
lazarevevgeny merged 7 commits intoopenvinotoolkit:masterfrom Mar 4, 2021
Merged
Conversation
vgavrilo
approved these changes
Mar 4, 2021
pavel-esir
approved these changes
Mar 4, 2021
Contributor
pavel-esir
left a comment
There was a problem hiding this comment.
Left a comment about a typo. In general looks good to me
rkazants
reviewed
Mar 4, 2021
rkazants
reviewed
Mar 4, 2021
rkazants
reviewed
Mar 4, 2021
rkazants
reviewed
Mar 4, 2021
Comment on lines
+331
to
+332
| if not any([attr['to_layer'] == body_parameter.soft_get('internal_layer_id') for attr in loop_node.back_edges]): | ||
| return True |
Collaborator
There was a problem hiding this comment.
nit: we know that the number of back edges is equal either to 0 or 1:
needed_back_edges = [attr['to_layer'] == body_parameter.soft_get('internal_layer_id') for attr in loop_node.back_edges]
if len(needed_back_edges) == 0:
return True
assert len(needed_back_edges) == 1
back_edge_attrs = needed_back_edges[0]
result_internal_id = back_edge_attrs['from_layer']
result_nodes = loop_node.body.get_op_nodes(internal_layer_id=result_internal_id)
assert len(result_nodes) == 1, 'There should be exactly one node with id {}, but there are {}' \
''.format(result_internal_id, len(result_nodes))
result_node = result_nodes[0]
parameters = common_bfs(result_node, ['Identity'], ['Parameter'], is_backward=True, attr_to_check='op',
follow_multi_consumer_data_nodes=True)
if any([node.soft_get('internal_layer_id') == body_parameter.internal_layer_id for node in parameters]):
return True
And you do not need for loop and if check then
Collaborator
|
The TF2 RNN layer tests pass as expected and no new failure observed. |
rkazants
approved these changes
Mar 4, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description: Added additional check to the function which pulls Const input into the Loop body. This check make sure that if there is a back edge to the body Parameter which gets a Const as input (from the main graph) then the value of this tensor is not changed during the iteration.
Ticket: 50269
Code:
Validation:
Documentation: