-
Notifications
You must be signed in to change notification settings - Fork 89
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
f/rrules
should support receiving ZeroTangent()
#442
Comments
I think most of the oens under 3 should be solved via implementing them for |
Should every
What cases are there where a zero tangent should become something nonzero? |
The case we have to worry about is functions with multiple inputs, some of which are zero, and some of which are not. Which as I say that, I realize makes no sense: pullbacks always have 1 input, because julia functions are all single output (it is just sometimes that output is an iterator). |
Yes, I guess if your function returns a tuple, then it may have to worry about getting back
|
|
What do you mean by "handled at a higher level"? Like handled automatically by the AD system, or making |
Handled in the AD system before calling the pullback. |
Similarly to #408,
ZeroTangent()
is a valid input to the pullback, and we need to make sure it is supported.Using JuliaDiff/ChainRulesTestUtils.jl#176, there are at least three kinds of errors:
ZeroTangent()
, e.g.MethodError: no method matching (::ChainRules.var"#transpose_pullback#1894")(::ZeroTangent)
. These just need to be fixed in ChainRules.jlproject
theZeroTangent()
:TypeError: in Hermitian, in S, expected S<:(AbstractArray{var"#s832", 2} where var"#s832"<:T), got Type{ZeroTangent}
and
project
ing theZeroTangent()
e.g.MethodError: no method matching getindex(::ZeroTangent, ::Int64)
. The question is whether we actually want to project to an array, since that would allocate quite a bit. Alternatively, we could defineBase.getindex(::ZeroTangent, args...) = ZeroTangent()
. There might be quite a few of these functions to define, but it would be much faster.Some examples are:
MethodError: no method matching Complex(::ZeroTangent)
MethodError: no method matching mapfoldl(::typeof(identity), ::typeof(Base.add_sum), ::ZeroTangent; dims=Colon())
MethodError: no method matching tr(::ZeroTangent)
MethodError: no method matching mul!(::ZeroTangent, ::Matrix{Float64}, ::ZeroTangent, ::Bool, ::Bool)
MethodError: no method matching trsyl!(::Char, ::Char, ::Matrix{ComplexF64}, ::Matrix{ComplexF64}, ::ZeroTangent)
MethodError: no method matching size(::ZeroTangent, ::Int64)
MethodError: no method matching LowerTriangular(::ZeroTangent)
and the list goes on
This is just a quick (incomplete) dump of observations and first thoughts. I may have missed kinds of errors, or said things which are untrue.
Alltogether:
The text was updated successfully, but these errors were encountered: