Skip to content

Commit

Permalink
[Frontend][Relay] Fix node indices attribute error for tensorflow 2.3 (
Browse files Browse the repository at this point in the history
…apache#6288)

* Fix errors caused due to node attributes

* Add node_indices attr for old keras pkg support
  • Loading branch information
iswariyam authored and Trevor Morris committed Sep 2, 2020
1 parent cd831a9 commit cc66660
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions python/tvm/relay/frontend/keras.py
Original file line number Diff line number Diff line change
Expand Up @@ -1073,11 +1073,18 @@ def _convert_input_layer(keras_layer):
# The one exception is InputLayer. Changing input variable names after conversion
# would confuse users, so we should keep them as far as possible. Fortunately,
# they are named uniquely to input_1, input_2, input_3... by default.
zip_node = zip(
_as_list(node.node_indices),
_as_list(node.tensor_indices),
_as_list(node.inbound_layers))
for n_idx, t_idx, inbound_layer in zip_node:
# node_indices attribute removed in tensorflow 2.3, however iterate_inbound() can
# be used
if hasattr(node, 'node_indices'):
zip_node = zip(
_as_list(node.inbound_layers),
_as_list(node.node_indices),
_as_list(node.tensor_indices),
_as_list(node.input_tensors))
node_attributes = zip_node
else:
node_attributes = node.iterate_inbound()
for inbound_layer, n_idx, t_idx, _ in node_attributes:
if isinstance(inbound_layer, input_layer_class):
expr_name = inbound_layer.name
_convert_input_layer(inbound_layer)
Expand Down

0 comments on commit cc66660

Please sign in to comment.