You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Should to_vec(::Integer) return an empty vector #188
The practical problem with this, is that sometimes people want to test special case methods that take integers.
Which is just all round hard, since when finite diferencing they don't get integers.
But they might still want to test it against custom rules that do.
So I wonder if we really need to handle this better in CRTU or somewhere in FiniteDifferences.
function rrule(::typeof(sinpi), x)
sinpi_pullback(dy) = -pi*cospi(x)
foo(x), sinpi_pullback
end
function rrule(::typeof(sinpi), x::Integer)
sinpi_pullback(dy) = Zero()
foo(x), sinpi_pullback
end
Activity
willtebbutt commentedon Aug 4, 2021
This would make sense to me.
oxinabox commentedon Oct 1, 2021
The practical problem with this, is that sometimes people want to test special case methods that take integers.
Which is just all round hard, since when finite diferencing they don't get integers.
But they might still want to test it against custom rules that do.
So I wonder if we really need to handle this better in CRTU or somewhere in FiniteDifferences.
Right now we often (always?) error for it
willtebbutt commentedon Oct 1, 2021
Could you provide an example @oxinabox ? I'm not really clear what sort of thing you're imagining.
oxinabox commentedon Oct 1, 2021
For example
willtebbutt commentedon Oct 1, 2021
And what we're proposing to do here would solve this problem, yes?
oxinabox commentedon Oct 1, 2021
Would it? Cool!
mcabbott commentedon Oct 1, 2021
Isn't this example the thing which already works? Integer taken to mean non-differentiable:
willtebbutt commentedon Oct 1, 2021
Oh, yeah, this particular example is. I think stuff would need to be nested in order to break it.