Skip to content

Commit

Permalink
Add unthunk in conv.jl (#620)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcabbott authored Jan 9, 2025
1 parent 5732b97 commit b56ff50
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "NNlib"
uuid = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
version = "0.9.26"
version = "0.9.27"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Expand Down
16 changes: 8 additions & 8 deletions src/conv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -343,25 +343,25 @@ 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_filter(x, unthunk(Δ), cdims, kw...)),
@thunk($∇conv_data(Δ, w, cdims, kw...)),
@thunk($∇conv_filter(x, Δ, cdims, kw...)),
NoTangent(),
)
end
return $conv(x, w, cdims; kw...), $conv_pullback
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_filter(unthunk(Δ), x, cdims, kw...)),
@thunk($conv(Δ, w, cdims, kw...)),
@thunk($∇conv_filter(Δ, x, cdims, kw...)),
NoTangent(),
)
end
Expand Down

2 comments on commit b56ff50

@CarloLucibello
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/122668

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.9.27 -m "<description of version>" b56ff500e48651567b9915bdcf3489fc28b248df
git push origin v0.9.27

Please sign in to comment.