-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fix issue with control flow v2 nested loop #3380
Conversation
…ow warning if reset_after is set to True
…nested loop output tensor id, updated the integration tests to honor dtype;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 1 of 1 approvals obtained (waiting on @lina128 and @pyu10055)
e2e/integration_tests/convert_predict.py, line 304 at r1 (raw file):
tf.TensorSpec([], tf.int32)]) def control_flow(self, x, y, z): while x < z:
When x >= y && x < z, what happens?
e2e/integration_tests/test_util.ts, line 34 at r1 (raw file):
const input = tfc.tensor( inputsData[i], inputsShapes[i], inputDtypes ? inputDtypes[i] : 'float32');
This is not necessary. The tensor method has a default for dtype.
tfjs-converter/python/tensorflowjs/converters/graph_rewrite_util.py, line 128 at r1 (raw file):
for i, input_node in enumerate(new_node.input): for name in constant_names: if input_node.startswith(name):
Curious, why startswith not equal?
tfjs-converter/python/tensorflowjs/converters/graph_rewrite_util.py, line 129 at r1 (raw file):
for name in constant_names: if input_node.startswith(name): new_node.input[i] = prefix + '/' + input_node
break?
tfjs-converter/python/tensorflowjs/converters/tf_saved_model_conversion_v2.py, line 254 at r1 (raw file):
func.node_def, func.signature.name) del func.node_def[:] func.node_def.extend(nodes)
If empty then extend, why not just reassign?
tfjs-converter/src/executor/graph_executor.ts, line 112 at r1 (raw file):
} constructor(private graph: Graph, private parent?: GraphExecutor) {
This is a cleaner implementation than set weights redundantly. It also implies the dependency between graph and subgraph. I really like this improvement! This may not be intuitive for someone who doesn't know about the function subgraph design. Can you add some annotation to explain what this for? Something like: Use case: v2 control flow function can form subgraphs, pass parent graph so that the subgraph can access node weights.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 1 of 1 approvals obtained (waiting on @lina128)
e2e/integration_tests/convert_predict.py, line 304 at r1 (raw file):
Previously, lina128 (Na Li) wrote…
When x >= y && x < z, what happens?
do nothing I guess, this is a really a stupid example than demonstrate the nested loop.
e2e/integration_tests/test_util.ts, line 34 at r1 (raw file):
Previously, lina128 (Na Li) wrote…
This is not necessary. The tensor method has a default for dtype.
just to be consistent, otherwise need to have two tfc.tensor calls?
tfjs-converter/python/tensorflowjs/converters/graph_rewrite_util.py, line 128 at r1 (raw file):
Previously, lina128 (Na Li) wrote…
Curious, why startswith not equal?
the input include multiple parts, name:output:index
for example
add:z:0
means add node output 0, not sure what the middle section is for, but it is there.
tfjs-converter/python/tensorflowjs/converters/graph_rewrite_util.py, line 129 at r1 (raw file):
Previously, lina128 (Na Li) wrote…
break?
it could use the same node multiple times, for example add(x, x)
tfjs-converter/python/tensorflowjs/converters/tf_saved_model_conversion_v2.py, line 254 at r1 (raw file):
Previously, lina128 (Na Li) wrote…
If empty then extend, why not just reassign?
protobuf can not reassign
tfjs-converter/src/executor/graph_executor.ts, line 112 at r1 (raw file):
Previously, lina128 (Na Li) wrote…
This is a cleaner implementation than set weights redundantly. It also implies the dependency between graph and subgraph. I really like this improvement! This may not be intuitive for someone who doesn't know about the function subgraph design. Can you add some annotation to explain what this for? Something like: Use case: v2 control flow function can form subgraphs, pass parent graph so that the subgraph can access node weights.
thanks, will add comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 1 of 1 approvals obtained (waiting on @lina128)
tfjs-converter/python/tensorflowjs/converters/tf_saved_model_conversion_v2.py, line 254 at r1 (raw file):
Previously, pyu10055 (Ping Yu) wrote…
protobuf can not reassign
protobuf repeated field cannot reassign.
Added weight name scoping for branch functions
Fixed output tensor id issue for function execution
Updated integration test to use nested loop for control flow v2
Updated integration test to honor tensor dtypes.
To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.
This change is