Skip to content

Commit f8cb89b

Browse files
fix when there's few cols
1 parent d71cf5c commit f8cb89b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/impl/conv_im2col.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function conv_im2col!(
4747

4848
parts = collect(Iterators.partition(axes(x, 5), ceil(Int, size(x, 5) / ntasks)))
4949

50-
@sync for task_n in 1:ntasks
50+
@sync for task_n in eachindex(parts)
5151
Threads.@spawn begin
5252
col_slice = col_slice = view(col, :, :, task_n) # col_slice is a task-local workspace
5353
for batch_idx in parts[task_n]
@@ -152,7 +152,7 @@ function ∇conv_data_im2col!(
152152

153153
parts = collect(Iterators.partition(axes(dx, 5), ceil(Int, size(dx, 5) / ntasks)))
154154

155-
@sync for task_n in 1:ntasks
155+
@sync for task_n in eachindex(parts)
156156
Threads.@spawn begin
157157
col_slice = col_slice = view(col, :, :, task_n) # col_slice is a task-local workspace
158158
for batch_idx in parts[task_n]

src/impl/depthwiseconv_im2col.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function depthwiseconv_im2col!(
3030

3131
dcdims = DenseConvDims(cdims)
3232

33-
@sync for task_n in 1:ntasks
33+
@sync for task_n in eachindex(parts)
3434
Threads.@spawn begin
3535
col_slice = col_slice = view(col, :, :, task_n) # col_slice is a task-local workspace
3636
for batch_idx in parts[task_n]
@@ -117,7 +117,7 @@ function ∇depthwiseconv_data_im2col!(
117117

118118
parts = collect(Iterators.partition(axes(dx)[end], ceil(Int, size(dx, 5) / ntasks)))
119119

120-
@sync for task_n in 1:ntasks
120+
@sync for task_n in eachindex(parts)
121121
Threads.@spawn begin
122122
col_slice = col_slice = view(col, :, :, task_n) # col_slice is a task-local workspace
123123
for batch_idx in parts[task_n]

0 commit comments

Comments
 (0)