Commit 6e444b6 1 parent e2d5bc5 commit 6e444b6 Copy full SHA for 6e444b6
File tree 1 file changed +4
-3
lines changed
src/test/java/org/opensearch/knn/jni
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 57
57
import static org .opensearch .knn .common .KNNConstants .PARAMETERS ;
58
58
59
59
public class JNIServiceTests extends KNNTestCase {
60
-
60
+ static final int FP16_MAX = 65504 ;
61
+ static final int FP16_MIN = -65504 ;
61
62
static TestUtils .TestData testData ;
62
63
static TestUtils .TestData testDataNested ;
63
64
private String faissMethod = "HNSW32,Flat" ;
@@ -553,9 +554,9 @@ private float[][] truncateToFp16Range(final float[][] data) {
553
554
for (int i = 0 ; i < data .length ; i ++) {
554
555
for (int j = 0 ; j < data [i ].length ; j ++) {
555
556
float value = data [i ][j ];
556
- if (value < Float . MIN_VALUE || value > Float . MAX_VALUE ) {
557
+ if (value < FP16_MIN || value > FP16_MAX ) {
557
558
// If value is outside of the range, set it to the maximum or minimum value
558
- result [i ][j ] = value < 0 ? - Float . MAX_VALUE : Float . MAX_VALUE ;
559
+ result [i ][j ] = value < 0 ? FP16_MIN : FP16_MAX ;
559
560
} else {
560
561
result [i ][j ] = value ;
561
562
}
You can’t perform that action at this time.
0 commit comments