Diffractor.jl icon indicating copy to clipboard operation
Diffractor.jl copied to clipboard

Next-generation AD

Results 74 Diffractor.jl issues
Sort by recently updated
recently updated
newest added

This ought to return a tuple; what it returns now works in some contexts but not https://github.com/JuliaDiff/ChainRules.jl/pull/644 . ```julia julia> using Diffractor, ChainRulesCore julia> ret = rrule_via_ad(Diffractor.DiffractorRuleConfig(), x -> log(exp(x)),...

Needs some corresponding changes in Cthulhu

This came up while trying to run Flux models with `Chain{

This uses a slightly different definition of the jacobian than ForwardDiff. For jacobian(f:N×M->P) it will return a result of shape `P×N×M` while ForwardDiff will return `P×(N⋅M)`

At present Diffractor may return thunks, but doesn't seem use them (or anything else) to accumulate effciently: ```julia julia> @btime gradient(x -> sum(x), $(rand(100, 100))) |> first |> typeof min...

This adds many tests from Zygote. I've done some filtering to leave out the most repetitive ones, things which clearly don't apply (like Params), and things testing rules for external...

I'm pretty confident this worked in September, ~~but have no idea whether changes here or in ChainRules broke it:~~ Edit -- the change is https://github.com/JuliaDiff/ChainRulesCore.jl/pull/495, discussed there. ```julia julia> Diffractor.gradient(cbrt,...

```julia julia> gradient(x -> x.re, 2+3im) (Tangent{Complex{Int64}}(re = 1,),) julia> gradient(x -> abs2(x * x.re), 4+5im) ERROR: MethodError: no method matching +(::ComplexF64, ::Tangent{Complex{Int64}, NamedTuple{(:re,), Tuple{Float64}}}) ```

These should agree, right? ```julia julia> Diffractor.PrimeDerivativeBack(x -> real(sin(x)))(1+im) 0.8337300251311491 + 0.9888977057628651im julia> Diffractor.PrimeDerivativeFwd(x -> real(sin(x)))(1+im) ERROR: Tangent space not defined for `Complex{Int64}. ```

forward-mode

Even though Diffractor isn't yet feature complete, it can already be a [major improvement](https://github.com/FluxML/Flux.jl/pull/1809#discussion_r777770025) over Zygote for real-world use cases.