Skip to content

Commit b7509f3

Browse files
committed
refactor: remove old softmax function
1 parent 8d289a1 commit b7509f3

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

encoderfile/src/inference/utils.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,6 @@ pub fn l2_normalize(mut x: Array2<f32>, axis: Axis) -> Array2<f32> {
5555
x
5656
}
5757

58-
pub fn softmax(x: &Array2<f32>, axis: Axis) -> Array2<f32> {
59-
let max_per_axis = x.map_axis(axis, |row| row.fold(f32::NEG_INFINITY, |a, &b| a.max(b)));
60-
let expx = x - &max_per_axis.insert_axis(axis);
61-
let expx = expx.mapv(f32::exp);
62-
let sum = expx.sum_axis(axis).insert_axis(axis);
63-
&expx / &sum
64-
}
65-
6658
pub fn requires_token_type_ids<'a>(session: &MutexGuard<'a, Session>) -> bool {
6759
session
6860
.inputs

0 commit comments

Comments
 (0)