Skip to content

Commit

Permalink
Merge pull request #36 from bionanoimaging/fix_conv_rrule
Browse files Browse the repository at this point in the history
Remove wrong rule to fix issue #35
  • Loading branch information
roflmaostc authored Dec 11, 2023
2 parents 70ec7bf + 79cd82a commit 35939bb
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions src/convolutions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,6 @@ function conv_psf(u::AbstractArray{T, N}, psf::AbstractArray{D, M}, dims=ntuple(
return conv(u, ifftshift(psf, dims), dims)
end

# define custom adjoint for conv
# so far only defined for the derivative regarding the first component
function ChainRulesCore.rrule(::typeof(conv), u::AbstractArray{T, N}, v::AbstractArray{D, M},
dims=ntuple(+, min(N, M))) where {T, D, N, M}
Y = conv(u, v, dims)
function conv_pullback(barx)
z = zero(eltype(u))
return NoTangent(), conv(barx, conj(v), dims), z, z
end
return Y, conv_pullback
end



"""
Expand Down Expand Up @@ -219,15 +207,6 @@ function p_conv_aux(P, P_inv, u, v_ft)
return (P_inv.p * ((P * u) .* v_ft .* P_inv.scale))
end

function ChainRulesCore.rrule(::typeof(p_conv_aux), P, P_inv, u, v)
Y = p_conv_aux(P, P_inv, u, v)
function conv_pullback(barx)
z = zero(eltype(u))
= p_conv_aux(P, P_inv, barx, conj(v))
return NoTangent(), z, z, ∇, z
end
return Y, conv_pullback
end

"""
fft_or_rfft(T)
Expand Down

0 comments on commit 35939bb

Please sign in to comment.