Skip to content

Commit 416caf8

Browse files
author
Andrzejewski, Kamil
committed
cpu: bnorm: fix for illegal division by 0
1 parent b3540a8 commit 416caf8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cpu/cpu_batch_normalization_utils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ bool thread_balance(bool do_blocking, bool spatial_thr_allowed, bool is_nspc,
7575
if (is_nspc) {
7676
if ((nthr <= C_blks && nthr == 1) || C_blks <= 8)
7777
C_nthr = 1;
78-
else if (C_blks <= 32)
78+
else if (nthr >= 8 && C_blks <= 32)
7979
C_nthr = 8;
8080
else {
8181
C_nthr = (int)math::gcd((dim_t)nthr, C_blks);
@@ -143,7 +143,7 @@ bool is_spatial_thr(const batch_normalization_pd_t *bdesc, bool is_nspc,
143143

144144
if ((nthr <= C_blks && nthr == 1) || C_blks <= 8)
145145
C_nthr = 1;
146-
else if (C_blks <= 32)
146+
else if (nthr >= 8 && C_blks <= 32)
147147
C_nthr = 8;
148148
else {
149149
C_nthr = math::gcd((dim_t)nthr, C_blks);

0 commit comments

Comments
 (0)