Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unthunk in conv.jl #620

Merged
merged 4 commits into from
Jan 9, 2025
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/conv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,11 @@ for conv in [:conv, :depthwiseconv]
conv_pullback, ∇conv_data_pullback = Symbol.([conv, ∇conv_data], :_pullback)

@eval function rrule(::typeof($conv), x, w, cdims; kw...)
function $conv_pullback(Δ)
Δ = colmajor(Δ)
function $conv_pullback(Δraw)
Δ = colmajor(unthunk(Δraw))
return (
NoTangent(),
@thunk($∇conv_data(unthunk(Δ), w, cdims, kw...)),
@thunk($∇conv_data(Δ, w, cdims, kw...)),
@thunk($∇conv_filter(x, unthunk(Δ), cdims, kw...)),
mcabbott marked this conversation as resolved.
Show resolved Hide resolved
NoTangent(),
)
Expand All @@ -356,11 +356,11 @@ for conv in [:conv, :depthwiseconv]
end

@eval function rrule(::typeof($∇conv_data), x, w, cdims; kw...)
function $∇conv_data_pullback(Δ)
Δ = colmajor(Δ)
function $∇conv_data_pullback(Δraw)
Δ = colmajor(unthunk(Δraw))
return (
NoTangent(),
@thunk($conv(unthunk(Δ), w, cdims, kw...)),
@thunk($conv(Δ, w, cdims, kw...)),
@thunk($∇conv_filter(unthunk(Δ), x, cdims, kw...)),
mcabbott marked this conversation as resolved.
Show resolved Hide resolved
NoTangent(),
)
Expand Down
Loading