-
Notifications
You must be signed in to change notification settings - Fork 83
Implement Save Tensor For Mxnet and Pytorch #291
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
Conversation
Codecov Report
@@ Coverage Diff @@
## save_inputs #291 +/- ##
===============================================
- Coverage 84.40% 79.91% -4.50%
===============================================
Files 86 86
Lines 6336 6363 +27
===============================================
- Hits 5348 5085 -263
- Misses 988 1278 +290
Continue to review full report at Codecov.
|
@@ -0,0 +1,209 @@ | |||
""" |
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.
Test:
numpy array.
regular array
smdebug/tensorflow/keras.py
Outdated
self._save_tensor(tensor_name, tensor_value, collection_names) | ||
self._save_tensor_to_file(tensor_name, tensor_value, collection_names) | ||
|
||
def _save_tensor(self, tensor_name, tensor_value, collections_to_write): |
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.
is there a conflict for the name _save_tensor() ? or are you changing this to avoid confusion with hook.save_tensor()?
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.
I'm changing this name to avoid confusion
tests/pytorch/utils.py
Outdated
model.train() | ||
# for batch_idx, (data, target) in enumerate(train_loader): | ||
if save_custom_tensor: | ||
hook.save_tensor("custom_tensor", torch.tensor([[1.0, -1.0], [1.0, -1.0]])) |
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.
add save_tensor calls at different points in the training loop. before, during, after - to check if it is getting written at the correct step. similar to save_scalar
hook.save_custom_tensor("custom_tensor_3", t3, include_collections) | ||
hook.save_tensor("custom_tensor_1", t1, include_collections) | ||
hook.save_tensor("custom_tensor_2", t2, include_collections) | ||
hook.save_tensor("custom_tensor_3", t3, include_collections) |
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.
save_tensor after fit() too? how are we verifying if the tensor is written at the right step and correct mode?
Description of changes:
save_tensor
api for pytorch and mxnetStyle and formatting:
I have run
pre-commit install
to 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.