@@ -12,17 +12,17 @@ function softmax!(x::A) where A<:AbstractVecOrMat{Float64}
12
12
end
13
13
14
14
softmax! (x:: A ) where A<: AbstractVecOrMat{Float32} =
15
- nnp_softmax_output (x, x, threadpool = shared_threadpool[] )
15
+ nnp_softmax_output (x, x)
16
16
17
17
softmax! (y:: A , x:: A ) where A<: AbstractVecOrMat{Float64} = softmax! (Float32 .(y), Float32 .(x))
18
18
19
19
softmax! (y:: A , x:: A ) where A<: AbstractVecOrMat{Float32} =
20
- nnp_softmax_output (x, y, threadpool = shared_threadpool[] )
20
+ nnp_softmax_output (x, y)
21
21
22
22
softmax (x:: A ) where A<: AbstractVecOrMat{Float64} = softmax (Float32 .(x))
23
23
24
24
softmax (x:: A ) where A<: AbstractVecOrMat{Float32} =
25
- nnp_softmax_output (x, similar (x), threadpool = shared_threadpool[] )
25
+ nnp_softmax_output (x, similar (x))
26
26
27
27
maxpool (x:: A , k; pad = map (_-> 0 ,k), stride = k) where A<: AbstractArray{Float64, 4} =
28
28
maxpool (Float32 .(x), k, pad = pad, stride = stride)
@@ -40,7 +40,7 @@ maxpool!(y::A, x::A, k; pad = map(_->0,k), stride = k) where A<:AbstractArray{Fl
40
40
maxpool! (Float32 .(y), Float32 .(x), k, pad = pad, stride = stride)
41
41
42
42
maxpool! (y:: A , x:: A , k; pad = map (_-> 0 ,k), stride = k) where A<: AbstractArray{Float32, 4} =
43
- nnp_max_pooling_output (x, y, k, padding = expand (Val{length (k)}, pad), stride = expand (Val{length (k)}, stride), threadpool = shared_threadpool[] )
43
+ nnp_max_pooling_output (x, y, k, padding = expand (Val{length (k)}, pad), stride = expand (Val{length (k)}, stride))
44
44
45
45
conv (x:: A , w:: A ; pad = 0 , stride = 1 , dilation = 1 , algo = UInt32 (0 )) where A<: AbstractArray{Float64, 4} =
46
46
conv (Float32 .(x), Float32 .(w), pad = pad, stride = stride, dilation = dilation, algo = algo)
@@ -88,7 +88,7 @@ function conv!(y::A1, x::A1, w::A1, b::A2; pad = 0, stride = 1, dilation = 1, al
88
88
if flipkernel == 0
89
89
w = reverse (reverse (w, dims= 1 ), dims= 2 )
90
90
end
91
- nnp_convolution_output (y, x, w, b, algo = algo, padding = pad, stride = stride, threadpool = shared_threadpool[] )
91
+ nnp_convolution_output (y, x, w, b, algo = algo, padding = pad, stride = stride)
92
92
end
93
93
94
94
crosscor! (y:: A1 , x:: A1 , w:: A1 , b:: A2 ; pad = 0 , stride = 1 , dilation = 1 , algo = UInt32 (0 )) where {A1<: AbstractArray{Float64, 4} , A2<: AbstractArray{Float64, 1} } =
@@ -104,7 +104,7 @@ function ∇conv_data(dy::A, x::A, w::A; pad = 0, stride = 1, dilation = 1, algo
104
104
pad_, stride_, fallback = check_support (x, (size (w, 1 ), size (w, 2 )), pad, stride, dilation)
105
105
if fallback
106
106
conv2d_grad_x! (zeros (Float32, size (x)), x, w, dy, padding = pad_, stride = stride_, dilation = dilation)
107
- else
107
+ else
108
108
∇conv_data! (zeros (Float32, size (x)), dy, x, w; pad = pad_, stride = stride_, dilation = dilation, algo = UInt32 (algo))
109
109
end
110
110
end
114
114
115
115
function ∇conv_data! (dx:: A , dy:: A , x:: A , w:: A ; pad = 0 , stride = 1 , dilation = 1 , algo = UInt32 (0 ), flipkernel = 0 ) where A<: AbstractArray{Float32, 4}
116
116
flipkernel == 0 && (w = reverse (reverse (w, dims= 1 ), dims= 2 ))
117
- nnp_convolution_input_gradient (dx, x, dy, w, padding = pad, stride = stride, algo = algo, threadpool = shared_threadpool[] )
117
+ nnp_convolution_input_gradient (dx, x, dy, w, padding = pad, stride = stride, algo = algo)
118
118
end
119
119
120
120
∇conv_filter (dy:: A , x:: A , w:: A ; pad = 0 , stride = 1 , dilation = 1 , algo = UInt32 (0 )) where A<: AbstractArray{Float64, 4} =
@@ -124,7 +124,7 @@ function ∇conv_filter(dy::A, x::A, w::A; pad = 0, stride = 1, dilation = 1, al
124
124
pad_, stride_, fallback = check_support (x, (size (w, 1 ), size (w, 2 )), pad, stride, dilation)
125
125
if fallback
126
126
conv2d_grad_w! (zeros (Float32, size (w)), x, w, dy, padding = pad_, stride = stride_, dilation = dilation)
127
- else
127
+ else
128
128
∇conv_filter! (zeros (Float32, size (w)), dy, x, w; pad = pad_, stride = stride_, dilation = dilation, algo = UInt32 (algo))
129
129
end
130
130
end
134
134
135
135
function ∇conv_filter! (dw:: A , dy:: A , x:: A , w:: A ; pad = 0 , stride = 1 , dilation = 1 , algo = UInt32 (0 ), flipkernel = 0 ) where A<: AbstractArray{Float32, 4}
136
136
flipkernel == 0 && (w = reverse (reverse (w, dims= 1 ), dims= 2 ))
137
- dw .= nnp_convolution_kernel_gradient (dw, x, dy, w, padding = pad, stride = stride, algo = algo, threadpool = shared_threadpool[] )
137
+ dw .= nnp_convolution_kernel_gradient (dw, x, dy, w, padding = pad, stride = stride, algo = algo)
138
138
flipkernel == 0 ? reverse (reverse (dw, dims= 1 ), dims= 2 ) : dw
139
139
end
0 commit comments