I want to estimate the Fisher Information matrix and in the network I have set some require_grads = False because I do not want them to be updated:

That is what I did

loglikelihood_grads = autograd.grad(loglikelihood, self.parameters())

```
parameter_names = [
n.replace('.', '__') for n, p in self.named_parameters()
]
return {n: g**2 for n, g in zip(parameter_names, loglikelihood_grads)}
```

I got the following error RuntimeError: **One of the differentiated Variables does not require grad.**

But if I replace self.parameters() with filter(lambda p: p.requires_grad, self.parameters()) in the loglikelihood_grads = autograd.grad(loglikelihood, self.parameters())

how can I find the proper order of names in the loglikelihood_grads that corresponging to?