fail();
}
}
+
+ @Test
+ public void testInvalidSNPEOptionRuntime_n() {
+ if (!NNStreamer.isAvailable(NNStreamer.NNFWType.SNPE)) {
+ /* cannot run the test */
+ return;
+ }
+
+ String invalid_option = "Runtime:invalid_runtime";
+ try {
+ File model = APITestCommon.getSNPEModel();
+ new SingleShot(new File[] {model}, null, null, NNStreamer.NNFWType.SNPE, invalid_option);
+ fail();
+ } catch (Exception e) {
+ /* expected */
+ }
+ }
+
+ @Test
+ public void testInvalidSNPEOptionCPUFallback_n() {
+ if (!NNStreamer.isAvailable(NNStreamer.NNFWType.SNPE)) {
+ /* cannot run the test */
+ return;
+ }
+
+ String invalid_option = "CPUFallback:invalid_value";
+ try {
+ File model = APITestCommon.getSNPEModel();
+ new SingleShot(new File[] {model}, null, null, NNStreamer.NNFWType.SNPE, invalid_option);
+ fail();
+ } catch (Exception e) {
+ /* expected */
+ }
+ }
+
+ @Test
+ public void testSNPEClassificationResultWithRuntimeDSP() {
+ if (!NNStreamer.isAvailable(NNStreamer.NNFWType.SNPE)) {
+ /* cannot run the test */
+ return;
+ }
+
+ /* expected label is measuring_cup (648) */
+ final int expected_label = 648;
+ String option_string = "Runtime:DSP";
+ try {
+ File model = APITestCommon.getSNPEModel();
+ SingleShot single = new SingleShot(new File[] {model}, null, null, NNStreamer.NNFWType.SNPE, option_string);
+
+ /* single-shot invoke */
+ TensorsData in = APITestCommon.readRawImageDataSNPE();
+ TensorsData out = single.invoke(in);
+ int labelIndex = APITestCommon.getMaxScoreSNPE(out.getTensorData(0));
+
+ /* check label index (measuring cup) */
+ if (labelIndex != expected_label) {
+ fail();
+ }
+
+ single.close();
+ } catch (Exception e) {
+ fail();
+ }
+ }
}