summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongjoo Ahn <yongjoo1.ahn@samsung.com>2024-09-04 14:38:10 +0900
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>2024-09-05 10:12:14 +0900
commit75cb1bd1ad6ee1d0adf4bb626263307f879d1b45 (patch)
tree7efb7d8d989e9127d1e7c179300c20f3c121434b
parent8db4448f69a4bd8c2b26a58ba99416b1832eac54 (diff)
downloadmachine-learning-75cb1bd1ad6ee1d0adf4bb626263307f879d1b45.tar.gz
machine-learning-75cb1bd1ad6ee1d0adf4bb626263307f879d1b45.tar.bz2
machine-learning-75cb1bd1ad6ee1d0adf4bb626263307f879d1b45.zip
[android] Use rank-aware dimension in android tests
- Let those tests use exact dimension with proper rank (Not using trailing `1`s in dimension). Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
-rw-r--r--java/android/nnstreamer/src/androidTest/java/org/nnsuite/nnstreamer/APITestCustomFilter.java2
-rw-r--r--java/android/nnstreamer/src/androidTest/java/org/nnsuite/nnstreamer/APITestPipeline.java3
-rw-r--r--java/android/nnstreamer/src/androidTest/java/org/nnsuite/nnstreamer/APITestSingleShot.java10
-rw-r--r--java/android/nnstreamer/src/androidTest/java/org/nnsuite/nnstreamer/APITestTensorsInfo.java18
4 files changed, 16 insertions, 17 deletions
diff --git a/java/android/nnstreamer/src/androidTest/java/org/nnsuite/nnstreamer/APITestCustomFilter.java b/java/android/nnstreamer/src/androidTest/java/org/nnsuite/nnstreamer/APITestCustomFilter.java
index a8130b9..bed7084 100644
--- a/java/android/nnstreamer/src/androidTest/java/org/nnsuite/nnstreamer/APITestCustomFilter.java
+++ b/java/android/nnstreamer/src/androidTest/java/org/nnsuite/nnstreamer/APITestCustomFilter.java
@@ -159,7 +159,7 @@ public class APITestCustomFilter {
@Test
public void testCustomFilters() {
String desc = "appsrc name=srcx ! " +
- "other/tensor,dimension=(string)10:1:1:1,type=(string)int32,framerate=(fraction)0/1 ! " +
+ "other/tensor,dimension=(string)10,type=(string)int32,framerate=(fraction)0/1 ! " +
"tensor_filter framework=custom-easy model=" + mCustomPassthrough.getName() + " ! " +
"tensor_filter framework=custom-easy model=" + mCustomConvert.getName() + " ! " +
"tensor_filter framework=custom-easy model=" + mCustomAdd.getName() + " ! " +
diff --git a/java/android/nnstreamer/src/androidTest/java/org/nnsuite/nnstreamer/APITestPipeline.java b/java/android/nnstreamer/src/androidTest/java/org/nnsuite/nnstreamer/APITestPipeline.java
index 8e379bf..d24e8d3 100644
--- a/java/android/nnstreamer/src/androidTest/java/org/nnsuite/nnstreamer/APITestPipeline.java
+++ b/java/android/nnstreamer/src/androidTest/java/org/nnsuite/nnstreamer/APITestPipeline.java
@@ -853,8 +853,7 @@ public class APITestPipeline {
mInvalidState = true;
}
- if (dimension[0] != 1 || dimension[1] != 500 ||
- dimension[2] != 1 || dimension[3] != 1) {
+ if (dimension[0] != 1 || dimension[1] != 500) {
mInvalidState = true;
}
diff --git a/java/android/nnstreamer/src/androidTest/java/org/nnsuite/nnstreamer/APITestSingleShot.java b/java/android/nnstreamer/src/androidTest/java/org/nnsuite/nnstreamer/APITestSingleShot.java
index e4a6d5b..1a31d12 100644
--- a/java/android/nnstreamer/src/androidTest/java/org/nnsuite/nnstreamer/APITestSingleShot.java
+++ b/java/android/nnstreamer/src/androidTest/java/org/nnsuite/nnstreamer/APITestSingleShot.java
@@ -91,7 +91,7 @@ public class APITestSingleShot {
/* output: uint8 1001:1 */
assertEquals(1, info.getTensorsCount());
assertEquals(NNStreamer.TensorType.UINT8, info.getTensorType(0));
- assertArrayEquals(new int[]{1001,1,1,1}, info.getTensorDimension(0));
+ assertArrayEquals(new int[]{1001,1}, info.getTensorDimension(0));
single.close();
} catch (Exception e) {
@@ -149,7 +149,7 @@ public class APITestSingleShot {
/* input: float32 with dimension 1 */
assertEquals(1, info.getTensorsCount());
assertEquals(NNStreamer.TensorType.FLOAT32, info.getTensorType(0));
- assertArrayEquals(new int[]{1,1,1,1}, info.getTensorDimension(0));
+ assertArrayEquals(new int[]{1}, info.getTensorDimension(0));
TensorsInfo newInfo = new TensorsInfo();
newInfo.addTensorInfo(NNStreamer.TensorType.FLOAT32, new int[]{10});
@@ -160,13 +160,13 @@ public class APITestSingleShot {
/* input: float32 with dimension 10 */
assertEquals(1, info.getTensorsCount());
assertEquals(NNStreamer.TensorType.FLOAT32, info.getTensorType(0));
- assertArrayEquals(new int[]{10,1,1,1}, info.getTensorDimension(0));
+ assertArrayEquals(new int[]{10}, info.getTensorDimension(0));
info = single.getOutputInfo();
/* output: float32 with dimension 10 */
assertEquals(1, info.getTensorsCount());
assertEquals(NNStreamer.TensorType.FLOAT32, info.getTensorType(0));
- assertArrayEquals(new int[]{10,1,1,1}, info.getTensorDimension(0));
+ assertArrayEquals(new int[]{10}, info.getTensorDimension(0));
single.close();
} catch (Exception e) {
@@ -658,7 +658,7 @@ public class APITestSingleShot {
SingleShot single = new SingleShot(APITestCommon.getTFLiteImgModel());
assertEquals("3:224:224:1", single.getValue("input"));
- assertEquals("1001:1:1:1", single.getValue("output"));
+ assertEquals("1001:1", single.getValue("output"));
single.close();
} catch (Exception e) {
diff --git a/java/android/nnstreamer/src/androidTest/java/org/nnsuite/nnstreamer/APITestTensorsInfo.java b/java/android/nnstreamer/src/androidTest/java/org/nnsuite/nnstreamer/APITestTensorsInfo.java
index 84d30dd..c79f915 100644
--- a/java/android/nnstreamer/src/androidTest/java/org/nnsuite/nnstreamer/APITestTensorsInfo.java
+++ b/java/android/nnstreamer/src/androidTest/java/org/nnsuite/nnstreamer/APITestTensorsInfo.java
@@ -50,15 +50,15 @@ public class APITestTensorsInfo {
assertEquals("name1", mInfo.getTensorName(0));
assertEquals(NNStreamer.TensorType.INT8, mInfo.getTensorType(0));
- assertArrayEquals(new int[]{1,1,1,1}, mInfo.getTensorDimension(0));
+ assertArrayEquals(new int[]{1}, mInfo.getTensorDimension(0));
assertEquals("name2", mInfo.getTensorName(1));
assertEquals(NNStreamer.TensorType.UINT8, mInfo.getTensorType(1));
- assertArrayEquals(new int[]{2,2,1,1}, mInfo.getTensorDimension(1));
+ assertArrayEquals(new int[]{2,2}, mInfo.getTensorDimension(1));
assertNull(mInfo.getTensorName(2));
assertEquals(NNStreamer.TensorType.FLOAT32, mInfo.getTensorType(2));
- assertArrayEquals(new int[]{3,3,3,1}, mInfo.getTensorDimension(2));
+ assertArrayEquals(new int[]{3,3,3}, mInfo.getTensorDimension(2));
assertEquals(3, mInfo.getTensorsCount());
} catch (Exception e) {
@@ -92,15 +92,15 @@ public class APITestTensorsInfo {
/* check cloned info */
assertEquals("name1", cloned.getTensorName(0));
assertEquals(NNStreamer.TensorType.INT8, cloned.getTensorType(0));
- assertArrayEquals(new int[]{1,1,1,1}, cloned.getTensorDimension(0));
+ assertArrayEquals(new int[]{1}, cloned.getTensorDimension(0));
assertEquals("name2", cloned.getTensorName(1));
assertEquals(NNStreamer.TensorType.UINT8, cloned.getTensorType(1));
- assertArrayEquals(new int[]{2,2,1,1}, cloned.getTensorDimension(1));
+ assertArrayEquals(new int[]{2,2}, cloned.getTensorDimension(1));
assertNull(cloned.getTensorName(2));
assertEquals(NNStreamer.TensorType.FLOAT32, cloned.getTensorType(2));
- assertArrayEquals(new int[]{3,3,3,1}, cloned.getTensorDimension(2));
+ assertArrayEquals(new int[]{3,3,3}, cloned.getTensorDimension(2));
assertEquals(3, cloned.getTensorsCount());
} catch (Exception e) {
@@ -170,9 +170,9 @@ public class APITestTensorsInfo {
assertEquals(NNStreamer.TensorType.INT64, mInfo.getTensorType(2));
mInfo.setTensorDimension(2, new int[]{2,3});
- assertArrayEquals(new int[]{1,1,1,1}, mInfo.getTensorDimension(0));
- assertArrayEquals(new int[]{2,2,1,1}, mInfo.getTensorDimension(1));
- assertArrayEquals(new int[]{2,3,1,1}, mInfo.getTensorDimension(2));
+ assertArrayEquals(new int[]{1}, mInfo.getTensorDimension(0));
+ assertArrayEquals(new int[]{2,2}, mInfo.getTensorDimension(1));
+ assertArrayEquals(new int[]{2,3}, mInfo.getTensorDimension(2));
} catch (Exception e) {
fail();
}