Unverified Commit c3fc3894 authored by Anupam Bhatnagar's avatar Anupam Bhatnagar Committed by GitHub
Browse files

[Fix] - Finiteness check for all tensors (#890)

* Finiteness check for all tensors

* [skip ci] updating changelog
parent 49eacf12
...@@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ...@@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.4.4] - TBD ## [0.4.4] - TBD
### Fixed
- inf/nan check on all gradient tensors in ShardedGradScaler [#890]
### Added ### Added
### Changed ### Changed
......
...@@ -156,7 +156,7 @@ class ShardedGradScaler(TorchGradScaler): ...@@ -156,7 +156,7 @@ class ShardedGradScaler(TorchGradScaler):
assert found_inf.numel() == 1, "found_inf must be a 1-element tensor." assert found_inf.numel() == 1, "found_inf must be a 1-element tensor."
expected_device = grads[0].device expected_device = grads[0].device
for tensor in grads[0]: for tensor in grads:
try: try:
assert tensor.device == expected_device, "grads must be on the same device" assert tensor.device == expected_device, "grads must be on the same device"
except AssertionError: except AssertionError:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment