Skip to content

Commit c4e8573

Browse files
author
Avik Pal
committed
NNPACK convolution does not support stride
1 parent 018915c commit c4e8573

File tree

3 files changed

+3
-17
lines changed

3 files changed

+3
-17
lines changed

src/conv.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,8 @@ end
156156
# Use NNPACK if it is available and the operation is supported
157157
if is_nnpack_available()
158158
function conv(x::Array{xT, 4}, w::Array{wT, 4},
159-
cdims::DenseConvDims{2, K, C_in, C_out, S, P, (1, 1), F};
159+
cdims::DenseConvDims{2, K, C_in, C_out, (1, 1), P, (1, 1), F};
160160
kwargs...) where {xT, wT, K, C_in, C_out, S, P, F}
161-
func = check_supported_operation(x, cdims) ? conv_nnpack :
162-
xT == wT ? conv_im2col : conv_direct
163-
return func(x, w, cdims; kwargs...)
161+
return conv_nnpack(x, w, cdims; kwargs...)
164162
end
165163
end

src/nnpack/interface.jl

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,6 @@ function maxpool_nnpack(x::Array{T, 4}, pdims::PoolDims; kwargs...) where {T}
5151
end
5252

5353

54-
"""
55-
check_supported_operation(x::Array, cdims::DenseConvDims)
56-
57-
Returns `true` if nnpack supports the convolution operation for the given input.
58-
"""
59-
function check_supported_operation(x::Array{T, 4}, cdims::DenseConvDims{2, K, C_in,
60-
C_out, S, P, (1, 1), F}) where {T, K, C_in, C_out, S, P, F}
61-
val = size(x)[1:2] .+ (P[1] + P[2], P[3] + P[4]) .- K
62-
return val .% S == (0, 0) ? true : false
63-
end
64-
65-
6654
"""
6755
check_supported_operation(x::Array, pdims::PoolDims)
6856

src/pooling.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ end
132132
# Use NNPACK if it is available and operation is supported
133133
if is_nnpack_available()
134134
function maxpool(x::Array{T, 4}, pdims::PoolDims{2, K, S, P, (1, 1)}; kwargs...) where {T, K, S, P}
135-
func = check_supported_operation(x, pdims) ? maxpool_nnpack : maxpool_im2col
135+
func = check_supported_operation(x, pdims) ? maxpool_nnpack : maxpool_direct
136136
return func(x, pdims; kwargs...)
137137
end
138138
end

0 commit comments

Comments
 (0)