@@ -95,8 +95,8 @@ struct Conv{N,M,F,A,V}
95
95
end
96
96
97
97
"""
98
- Conv(weight::AbstractArray, bias, [ activation; stride, pad, dilation])
99
-
98
+ Conv(weight::AbstractArray, [ bias, activation; stride, pad, dilation])
99
+
100
100
Constructs a convolutional layer with the given weight and bias.
101
101
Accepts the same keywords (and has the same defaults) as the `Conv((4,4), 3=>7, relu)`
102
102
method.
@@ -117,13 +117,13 @@ julia> params(c1) |> length
117
117
2
118
118
```
119
119
"""
120
- function Conv (w:: AbstractArray{T,N} , b :: Union{Bool, Zeros, AbstractVector{T}} , σ = identity;
120
+ function Conv (w:: AbstractArray{T,N} , bias = true , σ = identity;
121
121
stride = 1 , pad = 0 , dilation = 1 ) where {T,N}
122
122
stride = expand (Val (N- 2 ), stride)
123
123
dilation = expand (Val (N- 2 ), dilation)
124
124
pad = calc_padding (Conv, pad, size (w)[1 : N- 2 ], dilation, stride)
125
- bias = create_bias (w, b , size (w, N))
126
- return Conv (σ, w, bias , stride, pad, dilation)
125
+ b = create_bias (w, bias , size (w, N))
126
+ return Conv (σ, w, b , stride, pad, dilation)
127
127
end
128
128
129
129
function Conv (k:: NTuple{N,Integer} , ch:: Pair{<:Integer,<:Integer} , σ = identity;
@@ -206,18 +206,18 @@ struct ConvTranspose{N,M,F,A,V}
206
206
end
207
207
208
208
"""
209
- ConvTranspose(weight::AbstractArray, bias, [ activation; stride, pad, dilation])
210
-
209
+ ConvTranspose(weight::AbstractArray, [ bias, activation; stride, pad, dilation])
210
+
211
211
Constructs a layer with the given weight and bias arrays.
212
212
Accepts the same keywords as the `ConvTranspose((4,4), 3=>7, relu)` method.
213
213
"""
214
- function ConvTranspose (w:: AbstractArray{T,N} , b :: Union{Bool, Zeros, AbstractVector{T}} , σ = identity;
214
+ function ConvTranspose (w:: AbstractArray{T,N} , bias = true , σ = identity;
215
215
stride = 1 , pad = 0 , dilation = 1 ) where {T,N}
216
216
stride = expand (Val (N- 2 ), stride)
217
217
dilation = expand (Val (N- 2 ), dilation)
218
218
pad = calc_padding (ConvTranspose, pad, size (w)[1 : N- 2 ], dilation, stride)
219
- bias = create_bias (w, b , size (w, N- 1 ))
220
- return ConvTranspose (σ, w, bias , stride, pad, dilation)
219
+ b = create_bias (w, bias , size (w, N- 1 ))
220
+ return ConvTranspose (σ, w, b , stride, pad, dilation)
221
221
end
222
222
223
223
function ConvTranspose (k:: NTuple{N,Integer} , ch:: Pair{<:Integer,<:Integer} , σ = identity;
@@ -304,17 +304,17 @@ end
304
304
305
305
"""
306
306
DepthwiseConv(weight::AbstractArray, bias, [activation; stride, pad, dilation])
307
-
307
+
308
308
Constructs a layer with the given weight and bias arrays.
309
309
Accepts the same keywords as the `DepthwiseConv((4,4), 3=>6, relu)` method.
310
310
"""
311
- function DepthwiseConv (w:: AbstractArray{T,N} , b :: Union{Bool, Zeros, AbstractVector{T}} , σ = identity;
311
+ function DepthwiseConv (w:: AbstractArray{T,N} , bias = true , σ = identity;
312
312
stride = 1 , pad = 0 , dilation = 1 ) where {T,N}
313
313
stride = expand (Val (N- 2 ), stride)
314
314
dilation = expand (Val (N- 2 ), dilation)
315
315
pad = calc_padding (DepthwiseConv, pad, size (w)[1 : N- 2 ], dilation, stride)
316
- bias = create_bias (w, b , prod (size (w)[N- 1 : end ]))
317
- return DepthwiseConv (σ, w, bias , stride, pad, dilation)
316
+ b = create_bias (w, bias , prod (size (w)[N- 1 : end ]))
317
+ return DepthwiseConv (σ, w, b , stride, pad, dilation)
318
318
end
319
319
320
320
function DepthwiseConv (k:: NTuple{N,Integer} , ch:: Pair{<:Integer,<:Integer} , σ = identity;
@@ -391,18 +391,18 @@ struct CrossCor{N,M,F,A,V}
391
391
end
392
392
393
393
"""
394
- CrossCor(weight::AbstractArray, bias, [ activation; stride, pad, dilation])
395
-
394
+ CrossCor(weight::AbstractArray, [ bias, activation; stride, pad, dilation])
395
+
396
396
Constructs a layer with the given weight and bias arrays.
397
397
Accepts the same keywords as the `CrossCor((4,4), 3=>7, relu)` method.
398
398
"""
399
- function CrossCor (w:: AbstractArray{T,N} , b :: Union{Bool, Zeros, AbstractVector{T}} , σ = identity;
399
+ function CrossCor (w:: AbstractArray{T,N} , bias = true , σ = identity;
400
400
stride = 1 , pad = 0 , dilation = 1 ) where {T,N}
401
401
stride = expand (Val (N- 2 ), stride)
402
402
dilation = expand (Val (N- 2 ), dilation)
403
403
pad = calc_padding (CrossCor, pad, size (w)[1 : N- 2 ], dilation, stride)
404
- bias = create_bias (w, b , size (w, N))
405
- return CrossCor (σ, w, bias , stride, pad, dilation)
404
+ b = create_bias (w, bias , size (w, N))
405
+ return CrossCor (σ, w, b , stride, pad, dilation)
406
406
end
407
407
408
408
function CrossCor (k:: NTuple{N,Integer} , ch:: Pair{<:Integer,<:Integer} , σ = identity;
0 commit comments