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

Error : y.register_hook in cvx_utils.py file #5

Open
ravinalawade13 opened this issue Nov 6, 2023 · 1 comment
Open

Error : y.register_hook in cvx_utils.py file #5

ravinalawade13 opened this issue Nov 6, 2023 · 1 comment

Comments

@ravinalawade13
Copy link

Original line was : y.register_hook(lambda grad,b=batch : torch.solve(grad[:,None], J[b].transpose(0,1))[0][:,0])

I changed to torch.linalg.solve, but still got error as
RuntimeError: linalg.solve: A must be batches of square matrices, but they are 65 by 1 matrices

I changed the code to the
y.register_hook(lambda grad,b=batch : torch.linalg.solve(J[b].transpose(0,1),grad[:,None])[:,0])
By this change, code works but I am not sure if operations are right ?

@kdhht2334
Copy link
Owner

Sorry for not being able to take a closer look.

In fact, I also referred to a lot of the tutorials below. I hope it helps you too.

https://implicit-layers-tutorial.org/

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

2 participants