Skip to content

Commit 77ba369

Browse files
authored
Merge pull request #227 from IntelPython/fix/npbench_mlp
Fix mlp numba parallel benchmark
2 parents 6cb14c8 + 4173ec0 commit 77ba369

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

dpbench/benchmarks/npbench/deep_learning/mlp/mlp_numba_np.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def softmax(x):
1818
new_shape = (x.shape[0], 1)
1919
# tmp_max = np.max(x, axis=-1, keepdims=True)
2020
tmp_max = np.empty(new_shape, dtype=x.dtype)
21-
for i in range(x.shape[1]):
22-
tmp_max[:, 0] = np.max(x[:, i])
21+
for i in range(x.shape[0]):
22+
tmp_max[i, 0] = np.max(x[i])
2323
tmp_out = np.exp(x - tmp_max)
2424
# tmp_sum = np.sum(tmp_out, axis=-1, keepdims=True)
2525
tmp_sum = np.reshape(np.sum(tmp_out, axis=-1), new_shape)

dpbench/benchmarks/npbench/deep_learning/mlp/mlp_numba_npr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def softmax(x):
1818
new_shape = (x.shape[0], 1)
1919
# tmp_max = np.max(x, axis=-1, keepdims=True)
2020
tmp_max = np.empty(new_shape, dtype=x.dtype)
21-
for i in nb.prange(x.shape[1]):
22-
tmp_max[:, 0] = np.max(x[:, i])
21+
for i in nb.prange(x.shape[0]):
22+
tmp_max[i, 0] = np.max(x[i])
2323
tmp_out = np.exp(x - tmp_max)
2424
# tmp_sum = np.sum(tmp_out, axis=-1, keepdims=True)
2525
tmp_sum = np.reshape(np.sum(tmp_out, axis=-1), new_shape)

0 commit comments

Comments
 (0)