Restore setAllowFp16PrecisionForFp32 test

While this method is deprecated, it should still be tested for basic
functionality.

PiperOrigin-RevId: 336913360
Change-Id: I78ea4e7b199bc24cddc4e8d6b04a301222153415
This commit is contained in:
Jared Duke 2020-10-13 11:04:28 -07:00 committed by TensorFlower Gardener
parent 4a08a20229
commit b9ffbb9f95

View File

@ -394,9 +394,13 @@ public final class InterpreterTest {
}
@Test
// setAllowFp16PrecisionForFp32 is deprecated, suppress the warning to allow testing.
@SuppressWarnings("deprecation")
public void testTurnOnNNAPI() throws Exception {
Interpreter interpreter =
new Interpreter(MODEL_BUFFER, new Interpreter.Options().setUseNNAPI(true));
new Interpreter(
MODEL_BUFFER,
new Interpreter.Options().setUseNNAPI(true).setAllowFp16PrecisionForFp32(true));
float[] oneD = {1.23f, 6.54f, 7.81f};
float[][] twoD = {oneD, oneD, oneD, oneD, oneD, oneD, oneD, oneD};
float[][][] threeD = {twoD, twoD, twoD, twoD, twoD, twoD, twoD, twoD};