Open
Conversation
…agemaker-debugger into save_nested_layers_tmp
Codecov Report
@@ Coverage Diff @@
## master #377 +/- ##
==========================================
- Coverage 85.49% 82.76% -2.73%
==========================================
Files 86 86
Lines 6514 6539 +25
==========================================
- Hits 5569 5412 -157
- Misses 945 1127 +182
Continue to review full report at Codecov.
|
vandanavk
reviewed
Nov 2, 2020
| layer_input = layer_input[0] | ||
| layer_input_tensor_name = get_export_name_for_keras(str(layer_name), "input") | ||
| layer_name = str(layer_name) | ||
| idx = layer_name_dict.get(layer_name, 0) |
Contributor
There was a problem hiding this comment.
will this be 0 always because this is the first time the dict has been accessed after L820?
| self._export_model() | ||
| self._exported_model[self.mode] = True | ||
|
|
||
| if is_tf_version_2x(): |
Contributor
There was a problem hiding this comment.
any restriction for eager/non-eager/tf.function?
| if isinstance(layer, str): | ||
| # Tensor.name is meaningless when eager execution is enabled. | ||
| return f"{layer}/{tensor_type}s" | ||
| return f"{layer}_{layer_idx}/{tensor_type}_{tensor_idx}" |
Contributor
There was a problem hiding this comment.
does this change how layer/tensor names have looked so far?
Comment on lines
+559
to
+579
| layer_inputs = self.saved_layers[layer_name].layer_input | ||
| for layer_idx, tensor in enumerate(layer_inputs): | ||
| if isinstance(tensor, list): | ||
| tensor_list = tensor | ||
| else: | ||
| tensor_list = [tensor] | ||
| if hasattr(tensor_list[0], "numpy") is False: | ||
| self.logger.warning( | ||
| "cannot save layer values during forward pass with tf.function" | ||
| ) | ||
| continue | ||
| else: | ||
| for t_idx, t in enumerate(tensor_list): | ||
| export_name = get_export_name_for_keras( | ||
| layer_name, | ||
| tensor_type="input", | ||
| tensor=tensor, | ||
| layer_idx=layer_idx, | ||
| tensor_idx=t_idx, | ||
| ) | ||
| self._save_tensor_to_file(export_name, t, layer_collection) |
Contributor
There was a problem hiding this comment.
this looks similar to what's done for outputs below. possible to make it common?
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 of changes:
_flatten_layersAPI. Seetests/tensorflow2/test_nested_layers.pyInputOutputSaverobject. Seetests/tensorflow2/test_model_that_reuses_layers.pytests/tensorflow2/test_concat_layer.pyStyle and formatting:
I have run
pre-commit installto ensure that auto-formatting happens with every commit.Issue number, if available
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.