use `ntuple` in conv

This commit is contained in:
Mike J Innes 2020-06-16 14:02:24 +01:00
parent 97406507fd
commit 9f931dd7fa
1 changed files with 2 additions and 2 deletions

View File

@ -132,7 +132,7 @@ end
function (c::Conv)(x::AbstractArray)
# TODO: breaks gpu broadcast :(
# ndims(x) == ndims(c.weight)-1 && return squeezebatch(c(reshape(x, size(x)..., 1)))
σ, b = c.σ, reshape(c.bias, map(_->1, c.stride)..., :, 1)
σ, b = c.σ, reshape(c.bias, ntuple(_->1, length(c.stride))..., :, 1)
cdims = DenseConvDims(x, c.weight; stride=c.stride, padding=c.pad, dilation=c.dilation)
σ.(conv(x, c.weight, cdims) .+ b)
end