on_after_backward docs for logging histograms
What is your question?
I was following the example on_after_backward code for logging parameter variables for tensorboard histograms.
https://pytorch-lightning.readthedocs.io/en/latest/_modules/pytorch_lightning/core/hooks.html#ModelHooks.on_after_backward
Code
# 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():
        self.logger.experiment.add_histogram(
            tag=k, values=v.grad, global_step=self.trainer.global_step
            )

and I was getting errors with v.grad in my state_dict v.grad is returning NoneTypes rather than valid tensors for all tensors?
Has the API for pytorch changed perhaps? or is this method mainly just suitable for logging the values of the variables instead of the gradients?
What's your environment?

OS: Ubuntu 20.04
Packaging pip
Version 1.1.4
pytorch 1.7.0