update example (#5753)

This commit is contained in:
Rohit Gupta 2021-02-11 20:02:11 +05:30 committed by GitHub
parent 8e9a026bc3
commit cf30b956a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -305,8 +305,7 @@ class ModelHooks:
def on_after_backward(self):
# example to inspect gradient information in tensorboard
if self.trainer.global_step % 25 == 0: # don't make the tf file huge
params = self.state_dict()
for k, v in params.items():
for k, v in self.named_parameters():
self.logger.experiment.add_histogram(
tag=k, values=v.grad, global_step=self.trainer.global_step
)