Skip to content

Commit

Permalink
fix #95
Browse files Browse the repository at this point in the history
  • Loading branch information
ziyiyin97 committed Mar 29, 2023
1 parent a25656d commit 2a724d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ext/AbstractFFTsChainRulesCoreExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function ChainRulesCore.rrule(::typeof(rfft), x::AbstractArray{<:Real}, dims)

project_x = ChainRulesCore.ProjectTo(x)
function rfft_pullback(ȳ)
= project_x(brfft(ChainRulesCore.unthunk(ȳ) ./ scale, d, dims))
= project_x(brfft(ChainRulesCore.unthunk(ȳ) ./ typeof(x)(scale), d, dims))
return ChainRulesCore.NoTangent(), x̄, ChainRulesCore.NoTangent()
end
return y, rfft_pullback
Expand Down Expand Up @@ -79,7 +79,7 @@ function ChainRulesCore.rrule(::typeof(irfft), x::AbstractArray, d::Int, dims)

project_x = ChainRulesCore.ProjectTo(x)
function irfft_pullback(ȳ)
= project_x(scale .* rfft(real.(ChainRulesCore.unthunk(ȳ)), dims))
= project_x(typeof(x)(scale) .* rfft(real.(ChainRulesCore.unthunk(ȳ)), dims))
return ChainRulesCore.NoTangent(), x̄, ChainRulesCore.NoTangent(), ChainRulesCore.NoTangent()
end
return y, irfft_pullback
Expand Down

0 comments on commit 2a724d0

Please sign in to comment.