graph: fix bug in parsing of _output_shapes attr #4867
Merged
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.
This fixes an issue where the Graph dashboard would die with "Graph: Failed Normalizing names" when trying to parse a graphdef containing a node with a mis-formatted
_output_shapes
attr. In particular, it fails if the_output_shapes
attr doesn't contain the top-levellist
property (either it's empty, or has only other properties). The fix is just to guard the logic by checking for that property's existence before dereferencing it.This attr is generated when calling
as_graph_def(add_shapes=True)
and I'm pretty sure that when constructed normally it should always have the.list.shape
property if it's present on the node at all:However, it seems like occasionally users end up with an attr value where that isn't the case, and even in those cases we should avoid breaking the graph visualization.
Googlers, see b/160928542.