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

refactor: add rule for zero(::Any) #791

Closed
wants to merge 1 commit into from

Conversation

sathvikbhagavan
Copy link
Member

@sathvikbhagavan sathvikbhagavan commented Jan 24, 2024

CI on master is broken. I suspect it is because of [email protected] - JuliaRegistries/General#99357

@sathvikbhagavan sathvikbhagavan changed the title build: try CI with [email protected] build: try CI with [email protected] Jan 24, 2024
@sathvikbhagavan
Copy link
Member Author

@ChrisRackauckas, the problem was coming from https://github.com/SciML/NeuralPDE.jl/blob/master/src/pinn_types.jl#L520 where it can be zero(::Vector{Float64}) which was erroring out like in https://github.com/SciML/NeuralPDE.jl/actions/runs/7625540660/job/20770044115#step:6:823.

I just added the rule here which was removed in JuliaDiff/ChainRules.jl#770 which fixes CI, although I am not completely sure if this is the right thing to do.

@sathvikbhagavan sathvikbhagavan changed the title build: try CI with [email protected] refactor: add rule for zero(::Any) Jan 24, 2024
@sathvikbhagavan sathvikbhagavan changed the title refactor: add rule for zero(::Any) refactor: add rule for zero(::Any) Jan 24, 2024
@ChrisRackauckas
Copy link
Member

@MasonProtter @oxinabox I think that PR might not have been as non-breaking as you thought 😅.

@MasonProtter
Copy link

MasonProtter commented Jan 24, 2024

Ugh, this thing is a real whack-a-mole. I'm having trouble understanding though why zero(::Vector) should be non-differentiable and return NoTangent() instead of returning ZeroTangent(), that just seems wrong to me.

I'm curious @sathvikbhagavan, can you test what happens here if you try to do

using ChainRulesCore: @scalar_rule
@scalar_rule zero(x::Any) ZeroTangent()

instead of using @non_differentiable?


Edit: nevermind, I just remembered why that won't work, scalar rules are only for ::Number.

@MasonProtter
Copy link

MasonProtter commented Jan 25, 2024

Okay, this is now fixed by JuliaDiff/ChainRules.jl#773, so I think this PR is not needed.

@sathvikbhagavan
Copy link
Member Author

Thanks @MasonProtter!

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

Successfully merging this pull request may close these issues.

3 participants