Skip to content

Commit

Permalink
Remove Zygote rule for *(::AbstractFFTs.Plan, ::AbstractArray)
Browse files Browse the repository at this point in the history
The potentially incorrect Zygote rules for FFT (#899) can be removed now that comprehensive Chain Rules have been added in JuliaMath/AbstractFFTs.jl#67
  • Loading branch information
vpuri3 authored Jul 5, 2023
1 parent 2f49370 commit b1c1a6e
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions src/lib/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -674,22 +674,6 @@ AbstractFFTs.rfft(x::Fill, dims...) = AbstractFFTs.rfft(collect(x), dims...)
AbstractFFTs.irfft(x::Fill, d, dims...) = AbstractFFTs.irfft(collect(x), d, dims...)
AbstractFFTs.brfft(x::Fill, d, dims...) = AbstractFFTs.brfft(collect(x), d, dims...)

# the adjoint jacobian of an FFT with respect to its input is the reverse FFT of the
# gradient of its inputs, but with different normalization factor
@adjoint function *(P::AbstractFFTs.Plan, xs)
return P * xs, function(Δ)
N = prod(size(xs)[[P.region...]])
return (nothing, N * (P \ Δ))
end
end

@adjoint function \(P::AbstractFFTs.Plan, xs)
return P \ xs, function(Δ)
N = prod(size(Δ)[[P.region...]])
return (nothing, (P * Δ)/N)
end
end

# FillArray functionality
# =======================

Expand Down

0 comments on commit b1c1a6e

Please sign in to comment.