Skip to content

Commit 30dd2e4

Browse files
committed
crosscor aligned with new API
1 parent 8ff0216 commit 30dd2e4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/conv.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@ function conv(x::A, w::A; size=nothing, pad = 0, stride = 1, dilation = 1) where
6262
conv!(similar(x, size), x, w, pad = pad_, stride = stride_, dilation = dilation)
6363
end
6464

65-
function crosscor(x::A, w::A; pad = 0, stride = 1, dilation = 1) where A<:AbstractArray
65+
function crosscor(x::A, w::A; size=nothing, pad = 0, stride = 1, dilation = 1) where A<:AbstractArray
6666
pad_, stride_ = padtuple(x, pad), padtuple(x, stride)
67-
crosscor!(similar(x, cdims(size(x), dilation_dims(w, dilation), pad_, stride_)),
68-
x, w, pad = pad_, stride = stride_, dilation = dilation)
67+
if size === nothing
68+
size = cdims(Base.size(x), dilation_dims(w, dilation), pad_, stride_)
69+
end
70+
crosscor!(similar(x, size), x, w, pad = pad_, stride = stride_, dilation = dilation)
6971
end
7072

7173
function ∇conv_data(dy::A, w::A; size=nothing, pad = 0, stride = 1, dilation = 1, flipkernel = 0) where A<:AbstractArray

0 commit comments

Comments
 (0)