-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* nnlib tweaks * Proper cuda tests * Depend on GPUArraysCore * Tweak NNlib implementation * Extra methods in CUDA * Make tuple_map always generated * Make tuple_map always generated * Remove redundant code * Tidy up build_tangent implementation * Add failing test cases * Tweak CUDA test file * Revert stuff added in a different PR * Tweaks to CUDA tests * Fix zero_rdata_from_type * Fix formatting * Make nnlib tests pass * Renable CuArray construction test * Make buildkite actually run nnlib tests * Fix display * Formatting * CI formatting * Revert tuple_map implementation change * Revert changes to tuple_map entirely * Bump patch version
- Loading branch information
1 parent
35b432c
commit 094dca6
Showing
8 changed files
with
151 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,75 @@ | ||
module MooncakeNNlibExt | ||
|
||
using NNlib, Random, Mooncake | ||
using GPUArraysCore, NNlib, Random, Mooncake | ||
using Base: IEEEFloat | ||
using NNlib: dropout | ||
|
||
using NNlib: conv, depthwiseconv | ||
import Mooncake: @from_rrule, DefaultCtx, MinimalCtx | ||
|
||
# Array types which we test rules against, so are confident work. | ||
const SupportedArray{P,N} = Union{Array{P,N},AbstractGPUArray{P,N}} | ||
|
||
@from_rrule( | ||
MinimalCtx, Tuple{typeof(batched_mul),Array{P,3},Array{P,3}} where {P<:IEEEFloat}, | ||
MinimalCtx, | ||
Tuple{typeof(batched_mul),SupportedArray{P,3},SupportedArray{P,3}} where {P<:IEEEFloat}, | ||
) | ||
@from_rrule( | ||
MinimalCtx, Tuple{typeof(dropout),AbstractRNG,Array{P},P} where {P<:IEEEFloat}, true, | ||
MinimalCtx, | ||
Tuple{typeof(dropout),AbstractRNG,SupportedArray{P},P} where {P<:IEEEFloat}, | ||
true, | ||
) | ||
@from_rrule(MinimalCtx, Tuple{typeof(softmax),Array{<:IEEEFloat}}, true) | ||
@from_rrule(MinimalCtx, Tuple{typeof(logsoftmax),Array{<:IEEEFloat}}, true) | ||
@from_rrule(MinimalCtx, Tuple{typeof(logsumexp),Array{<:IEEEFloat}}, true) | ||
@from_rrule(MinimalCtx, Tuple{typeof(softmax),SupportedArray{<:IEEEFloat}}, true) | ||
@from_rrule(MinimalCtx, Tuple{typeof(logsoftmax),SupportedArray{<:IEEEFloat}}, true) | ||
@from_rrule(MinimalCtx, Tuple{typeof(logsumexp),SupportedArray{<:IEEEFloat}}, true) | ||
@from_rrule( | ||
MinimalCtx, Tuple{typeof(upsample_nearest),Array{<:IEEEFloat},NTuple{N,Int} where {N}}, | ||
MinimalCtx, | ||
Tuple{typeof(upsample_nearest),SupportedArray{<:IEEEFloat},NTuple{N,Int} where {N}}, | ||
) | ||
@from_rrule( | ||
MinimalCtx, | ||
Tuple{typeof(NNlib.fold),Array{<:IEEEFloat},NTuple{N,Int} where {N},DenseConvDims}, | ||
Tuple{ | ||
typeof(NNlib.fold),SupportedArray{<:IEEEFloat},NTuple{N,Int} where {N},DenseConvDims | ||
}, | ||
) | ||
@from_rrule(MinimalCtx, Tuple{typeof(NNlib.unfold),Array{<:IEEEFloat},DenseConvDims}) | ||
@from_rrule( | ||
MinimalCtx, Tuple{typeof(NNlib.scatter),Any,Array,Array{<:Union{Integer,Tuple}}}, true, | ||
MinimalCtx, Tuple{typeof(NNlib.unfold),SupportedArray{<:IEEEFloat},DenseConvDims} | ||
) | ||
@from_rrule( | ||
MinimalCtx, | ||
Tuple{typeof(NNlib.scatter),Any,SupportedArray,SupportedArray{<:Union{Integer,Tuple}}}, | ||
true, | ||
) | ||
for conv in [:conv, :depthwiseconv] | ||
local ∇conv_data, ∇conv_filter = Symbol.(:∇, conv, [:_data, :_filter]) | ||
|
||
@eval @from_rrule( | ||
MinimalCtx, | ||
Tuple{typeof($conv),Array{P},Array{P},ConvDims} where {P<:IEEEFloat}, | ||
Tuple{ | ||
typeof($conv),SupportedArray{P},SupportedArray{P},ConvDims | ||
} where {P<:IEEEFloat}, | ||
true, | ||
) | ||
@eval @from_rrule( | ||
MinimalCtx, | ||
Tuple{typeof($∇conv_data),Array{P},Array{P},ConvDims} where {P<:IEEEFloat}, | ||
Tuple{ | ||
typeof($∇conv_data),SupportedArray{P},SupportedArray{P},ConvDims | ||
} where {P<:IEEEFloat}, | ||
true, | ||
) | ||
end | ||
@from_rrule( | ||
MinimalCtx, | ||
Tuple{typeof(∇conv_filter),Array{P},Array{P},ConvDims} where {P<:IEEEFloat}, | ||
Tuple{ | ||
typeof(∇conv_filter),SupportedArray{P},SupportedArray{P},ConvDims | ||
} where {P<:IEEEFloat}, | ||
true, | ||
) | ||
for pool in [:maxpool, :meanpool] | ||
@eval @from_rrule(MinimalCtx, Tuple{typeof($pool),Array{<:IEEEFloat},PoolDims}, true) | ||
@eval @from_rrule( | ||
MinimalCtx, Tuple{typeof($pool),SupportedArray{<:IEEEFloat},PoolDims}, true | ||
) | ||
end | ||
@from_rrule(MinimalCtx, Tuple{typeof(pad_constant),Array,Any,Any}, true) | ||
@from_rrule(MinimalCtx, Tuple{typeof(pad_constant),SupportedArray,Any,Any}, true) | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
[deps] | ||
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" | ||
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" | ||
Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" | ||
NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd" | ||
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
cuDNN = "02a925ec-e4fe-4b08-9a7e-0d78e3d38ccd" |
Oops, something went wrong.
094dca6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register()
094dca6
There was a problem hiding this comment.
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/122705
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.
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: