-
Notifications
You must be signed in to change notification settings - Fork 12
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
Perturbing the Camera results in incorrect Type Promotion in Backward Pass #31
Comments
@manuelbb-upb In the backward pass, you need to pass a Float32 value. So the last line should be changed to |
Thanks, I thought that the type was not important at that point ( I only used
Applying my fix from the first post makes it work. |
Interesting, there is nothing incorrect in your script, there must be some type promotion happening internally. It will take me some time to figure out what is the exact issue. The fix you propose is kind of bypassing the issue, but will result in problems if we want to use Float64. |
I was trying to differentiate with respect to the Camera position and therefore included the
get_primary_rays(c::Camera)
function in the loss function.Using Zygote 0.4.15 (and Julia 1.3), this results in a MethodError in the reverse pass, because at some point a Camera is instanciated with a vfov of type Float64 instead of Float32.
I have attached a minimal working example and the Stacktrace that results when executing it.
I am fairly new to Julia, so my investigation of the Zygote internals was a fruitless toil.
However there is a dirty fix to this.
In src/gradients/zygote.jl change lines 306-308 from
to
Attachments:
mwe_and_stacktrace.zip
The text was updated successfully, but these errors were encountered: