|
162 | 162 |
|
163 | 163 | function (c::Conv)(x::AbstractArray)
|
164 | 164 | σ, b = c.σ, reshape(c.bias, ntuple(_ -> 1, length(c.stride))..., :, 1)
|
165 |
| - cdims = DenseConvDims( |
166 |
| - x, c.weight; stride=c.stride, padding=c.pad, |
167 |
| - dilation=c.dilation, groups=c.groups) |
| 165 | + cdims = DenseConvDims(x, c.weight; stride = c.stride, padding = c.pad, dilation = c.dilation, groups = c.groups) |
168 | 166 | σ.(conv(x, c.weight, cdims) .+ b)
|
169 | 167 | end
|
170 | 168 |
|
@@ -658,23 +656,19 @@ julia> lay(rand(Float32, 100, 7, 50)) |> size
|
658 | 656 | (34, 7, 50)
|
659 | 657 | ```
|
660 | 658 | """
|
661 |
| -struct MaxPool{N, M} |
| 659 | +struct MaxPool{N,M} |
662 | 660 | k::NTuple{N,Int}
|
663 | 661 | pad::NTuple{M,Int}
|
664 | 662 | stride::NTuple{N,Int}
|
665 | 663 | end
|
666 | 664 |
|
667 |
| -function MaxPool(k::NTuple{N, Integer}; pad = 0, stride = k) where N |
| 665 | +function MaxPool(k::NTuple{N,Integer}; pad = 0, stride = k) where N |
668 | 666 | stride = expand(Val(N), stride)
|
669 | 667 | pad = calc_padding(MaxPool, pad, k, 1, stride)
|
670 | 668 | return MaxPool(k, pad, stride)
|
671 | 669 | end
|
672 | 670 |
|
673 | 671 | function (m::MaxPool)(x)
|
674 |
| - # size_x = size(x) |
675 |
| - # kernel, stride, padding, dilation = NNlib.prepare_pooldims( |
676 |
| - # Val(N), size_x, m.k; padding=m.pad, stride=m.stride) |
677 |
| - # pdims = PoolDims{kernel, stride, padding, dilation}(size_x) |
678 | 672 | pdims = PoolDims(x, m.k; padding=m.pad, stride=m.stride)
|
679 | 673 | return maxpool(x, pdims)
|
680 | 674 | end
|
|
0 commit comments