Skip to content
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

Can't call numpy() on Tensor that requires grad. Use tensor.detach().numpy() instead. #66

Open
masanorihirano opened this issue Jun 12, 2022 · 0 comments

Comments

@masanorihirano
Copy link
Owner

File ~/.local/lib/python3.8/site-packages/pytorch_extra_mhirano/experimental/variance_decomposition.py:272, in VarianceDecomposition.analysis_second_end(self)
    268 self.granger_causality_statistics = r * F
    269 # ToDo: torch.distributions.chi2.Chi2 does not support cdf at v1.11.0
    270 # chi2 = torch.distributions.chi2.Chi2(df=r)
    271 self.granger_causality_pvalues = 1 - torch.as_tensor(
--> 272     scipy.stats.chi2.cdf(self.granger_causality_statistics.cpu().numpy(), r)
    273 ).to(self.granger_causality_statistics)
    275 self.analysis_step = 0

RuntimeError: Can't call numpy() on Tensor that requires grad. Use tensor.detach().numpy() instead.
masanorihirano added a commit that referenced this issue Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant