File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
dpbench/benchmarks/npbench/deep_learning/mlp Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff 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 )
Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments