-
Notifications
You must be signed in to change notification settings - Fork 42
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
Autodiff doesn't work for * for AdjointTensorMap #157
Comments
Firstly, are you running the latest version of So, assuming the latest release. And assuming you're trying to make a vector i.e. Tensor rather than a TensorMap we get : A=Tensor(randnormal, ComplexF64,V*V*V'); To then answer your question. As far as I know AD methods are implemented for the @tensor macro. So let's rewrite your g(x) function using that : using TensorKit, Zygote
g(x)=real(scalar(x'*x))
function g_patched(x)
return real(@tensor conj(x[1,2,3])*x[1,2,3])
end which yields the same output. But works nicely with AD : V=Z3Space(0=>2,1=>2,2=>2);
A=Tensor(randnormal, ComplexF64,V*V*V');
gradient(g_patched, A) Admittedly it might be useful to implement Chainrules that make your usecase work as well. Especially since this would be more flexible concerning inputs (I guess this also makes it harder, I haven't looked into it.). |
I use the TensorKit version of [07d1fe3e] TensorKit v1.0.0-DEV |
Will close this since it is now fixed in the latest releases. |
Here is the example:
Output:
The text was updated successfully, but these errors were encountered: