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

Casting issue torch.nn.Parameter #11

Closed
JHnvidia opened this issue Jun 23, 2022 · 0 comments
Closed

Casting issue torch.nn.Parameter #11

JHnvidia opened this issue Jun 23, 2022 · 0 comments

Comments

@JHnvidia
Copy link

Not sure if this should be solved here, in cholespy, or nanobind. The from_differential function throws an error if the second argument is a torch.nn.Parameter rather than a tensor. Parameter is directly derived from Tensor, so there's no reason the cast should fail.

TypeError: solve(): incompatible function arguments. The following argument types are supported:
    1. solve(self, b: tensor[dtype=float32, order='C'], x: tensor[dtype=float32, order='C']) -> None

Invoked with types: CholeskySolverF, Parameter, Tensor

It's quite hard to workaround this "from the outside". E.g. doing from_differential(M, x.data) doesn't work because the gradient will be written to x.data.grad whereas the optimizer expects x.grad.

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