[java] Relaxing CoreML test (#16777)

### Description
Reduces precision on the CoreML provider test as it returns slightly
different answers than the other tested providers. Checked on a 2020 13"
M1 MBP.

### Motivation and Context
Fixes Java CoreML test failure after #16763.
This commit is contained in:
Adam Pocock 2023-08-09 14:43:05 -04:00 committed by GitHub
parent 07dfe34714
commit 03c3e91b0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -656,7 +656,12 @@ public class InferenceTest {
OnnxValue resultTensor = result.get(0);
float[] resultArray = TestHelpers.flattenFloat(resultTensor.getValue());
assertEquals(expectedOutput.length, resultArray.length);
assertArrayEquals(expectedOutput, resultArray, 1e-6f);
if (provider == OrtProvider.CORE_ML) {
// CoreML gives slightly different answers on a 2020 13" M1 MBP
assertArrayEquals(expectedOutput, resultArray, 1e-2f);
} else {
assertArrayEquals(expectedOutput, resultArray, 1e-6f);
}
} catch (OrtException e) {
throw new IllegalStateException("Failed to execute a scoring operation", e);
}