Skip to content

Commit d8b9b41

Browse files
Merge pull request #397 from vincentmolin/master
Move exports to main source file
2 parents aa86827 + 5a13f3f commit d8b9b41

19 files changed

+38
-60
lines changed

src/NNlib.jl

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,19 @@ using Requires
55
using ChainRulesCore
66
import ChainRulesCore: rrule
77
using Base.Broadcast: broadcasted
8+
using Base.Threads
9+
using Statistics
810
using Statistics: mean
11+
using LinearAlgebra
12+
using LinearAlgebra: BlasFloat, Transpose, Adjoint, AdjOrTransAbsMat
13+
using LinearAlgebra.BLAS: libblas, BlasInt, @blasfunc
914

1015
const IntOrIntTuple = Union{Integer, NTuple{N,<:Integer} where N}
1116
const Numeric = Union{AbstractArray{<:T}, T} where {T<:Number}
1217

1318
# Include APIs
1419
include("dim_helpers.jl")
20+
export ConvDims, DenseConvDims, PoolDims, DepthwiseConvDims
1521

1622
is_nnpack_available() = false
1723

@@ -27,14 +33,46 @@ is_nnpack_available() = false
2733
end
2834

2935
include("activations.jl")
36+
for f in ACTIVATIONS
37+
@eval export $(f)
38+
end
39+
export sigmoid, hardsigmoid, logsigmoid, thresholdrelu # Aliases
40+
3041
include("softmax.jl")
42+
export softmax, softmax!, ∇softmax, ∇softmax!, logsoftmax,
43+
logsoftmax!, ∇logsoftmax, ∇logsoftmax!, logsumexp
44+
45+
include("batched/batchedadjtrans.jl")
3146
include("batched/batchedmul.jl")
47+
export batched_mul, batched_mul!, , batched_vec,
48+
batched_transpose, batched_adjoint
49+
3250
include("gemm.jl")
51+
export grid_sample, ∇grid_sample
52+
3353
include("conv.jl")
54+
export conv, conv!, ∇conv_data, ∇conv_data!, ∇conv_filter,
55+
∇conv_filter!, depthwiseconv, depthwiseconv!,
56+
∇depthwiseconv_data, ∇depthwiseconv_data!,
57+
∇depthwiseconv_filter, ∇depthwiseconv_filter!
58+
3459
include("conv_bias_act.jl")
60+
export conv_bias_act, conv_bias_act!
61+
3562
include("pooling.jl")
63+
export maxpool, maxpool!, meanpool, meanpool!,
64+
∇maxpool, ∇maxpool!, ∇meanpool, ∇meanpool!
65+
3666
include("padding.jl")
67+
export pad_constant, pad_repeat, pad_reflect, pad_zeros
68+
3769
include("upsample.jl")
70+
export upsample_nearest, ∇upsample_nearest,
71+
upsample_linear, ∇upsample_linear,
72+
upsample_bilinear, ∇upsample_bilinear,
73+
upsample_trilinear, ∇upsample_trilinear,
74+
pixel_shuffle
75+
3876
include("gather.jl")
3977
include("scatter.jl")
4078
include("utils.jl")

src/activations.jl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@ ACTIVATIONS = [
1111
:tanh_fast, :sigmoid_fast,
1212
]
1313

14-
for f in ACTIVATIONS
15-
@eval export $(f)
16-
end
17-
18-
# Aliases
19-
export sigmoid, hardsigmoid, logsigmoid, thresholdrelu
20-
2114
# of type float (to allow for integer inputs)
2215
oftf(x, y) = oftype(float(x), y)
2316

src/batched/batchedadjtrans.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using LinearAlgebra
2-
31
import Base: -
42
import Adapt: adapt_structure, adapt
53

src/batched/batchedmul.jl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
2-
export batched_mul, batched_mul!, , batched_vec
3-
export batched_transpose, batched_adjoint
4-
5-
include("./batchedadjtrans.jl")
6-
7-
using LinearAlgebra: BlasFloat, Transpose, Adjoint, AdjOrTransAbsMat
8-
91
_unbatch(A) = A
102
_unbatch(A::BatchedAdjOrTrans) = parent(A)
113

src/conv.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
export conv, conv!, ∇conv_data, ∇conv_data!, ∇conv_filter, ∇conv_filter!, depthwiseconv,
2-
depthwiseconv!, ∇depthwiseconv_data, ∇depthwiseconv_data!, ∇depthwiseconv_filter,
3-
∇depthwiseconv_filter!
4-
51
## Convolution API
62
#
73
# We provide the following generic methods, for 3d, 4d, and 5d tensors, calculating 1d,

src/conv_bias_act.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
export conv_bias_act, conv_bias_act!
2-
31
function conv_bias_act(x::AbstractArray{xT,N}, w::AbstractArray{wT,N},
42
cdims::ConvDims, b::AbstractArray{bT,N}, σ=identity; kwargs...) where {xT, wT, bT, N}
53
y = similar(x, promote_type(xT, wT, bT), output_size(cdims)..., channels_out(cdims), size(x,N))

src/dim_helpers/ConvDims.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
export ConvDims
2-
31
"""
42
ConvDims
53

src/dim_helpers/DenseConvDims.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
export DenseConvDims
2-
31
"""
42
DenseConvDims
53

src/dim_helpers/DepthwiseConvDims.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
export DepthwiseConvDims
2-
31
"""
42
DepthwiseConvDims
53

src/dim_helpers/PoolDims.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
export PoolDims
2-
31
"""
42
PoolDims(x_size::NTuple{M}, k::Union{NTuple{L, Int}, Int};
53
stride=k, padding=0, dilation=1) where {M, L}

0 commit comments

Comments
 (0)