Michael Abbott
Michael Abbott
Yes there may be other solutions. This one is non-breaking now, and could equally well be an optional 2nd argument if you flip the order. It's more or less dispatch,...
Might be worth writing out the whole `rrule` for this 2-option case you envisage. I think the not-inplace thunk may also want to look pretty different, rather than rely on...
Note BTW that splats of matrices still cause a similar error: ```julia julia> gradient(x -> max(x...), [1 2; 3 4])[1] ERROR: MethodError: no method matching (::Diffractor.∂⃖recurse{1})(::typeof(Core._apply_iterate), ::typeof(iterate), ::typeof(max), ::Matrix{Int64}) Closest...
I think those should both be errors. But apparently little effort was made to check & handle them. This is an error but perhaps it should be a more helpful...
Failure in 1.6 is ``` selectors: Error During Test at /home/runner/work/AxisKeys.jl/AxisKeys.jl/test/_basic.jl:106 128 Test threw exception 129 Expression: [V4[Near(x)] for x = xs] == [V5[Near(x)] for x = xs] 130 BoundsError:...
Was going to reference Distributions / DistributionsAD as another model. But I see that the basic package now depends on CRC https://github.com/JuliaStats/Distributions.jl/pull/1390, moving toward option 1.
Yes something like this could be nice to have. The simple one which takes integer sizes can't be type-stable & I'd be a little hesitant to make that `Base.reshape`, although...
Re the `KeyedUnitRanges` story, I guess `ka.time` would always remain the key vector, and so that would have to read `reshape(ka, axes(ka, :time), :)` if it was to pass along...
Yes Zygote has such a function, but packages may want to check without depending on it. Like [NNlib here]( https://github.com/FluxML/NNlib.jl/pull/393/files#diff-858614f9f176124bafc3047ab7803e7c512f25a87f5f56661de0d3973c43a9ccR71-R83), where it's guarding a mutating path... seems likely to be...
Or lower-tech for that use, ensure that `is_inplaceable_destination` gives false within gradients. (Although I'm not sure I understand its rules... why is `ChainRulesCore.is_inplaceable_destination([1])` true, for integers?)