aboutsummaryrefslogtreecommitdiff
path: root/python/pyarmnn/test/test_tensor_info.py
diff options
context:
space:
mode:
authorRichard Burton <richard.burton@arm.com>2020-04-08 16:39:05 +0100
committerJim Flynn <jim.flynn@arm.com>2020-04-10 16:11:09 +0000
commitdc0c6ed9f8b993e63f492f203d7d7080ab4c835c (patch)
treeea8541990b13ebf1a038009aa6b8b4b1ea8c3f55 /python/pyarmnn/test/test_tensor_info.py
parentfe5a24beeef6e9a41366e694f41093565e748048 (diff)
downloadarmnn-dc0c6ed9f8b993e63f492f203d7d7080ab4c835c.tar.gz
Add PyArmNN to work with ArmNN API of 20.02
* Add Swig rules for generating python wrapper * Add documentation * Add tests and testing data Change-Id: If48eda08931514fa21e72214dfead2835f07237c Signed-off-by: Richard Burton <richard.burton@arm.com> Signed-off-by: Derek Lamberti <derek.lamberti@arm.com>
Diffstat (limited to 'python/pyarmnn/test/test_tensor_info.py')
-rw-r--r--python/pyarmnn/test/test_tensor_info.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/python/pyarmnn/test/test_tensor_info.py b/python/pyarmnn/test/test_tensor_info.py
new file mode 100644
index 0000000000..dc73533869
--- /dev/null
+++ b/python/pyarmnn/test/test_tensor_info.py
@@ -0,0 +1,27 @@
+# Copyright © 2020 Arm Ltd. All rights reserved.
+# SPDX-License-Identifier: MIT
+import pyarmnn as ann
+
+
+def test_tensor_info_ctor_shape():
+ tensor_shape = ann.TensorShape((1, 1, 2))
+
+ tensor_info = ann.TensorInfo(tensor_shape, ann.DataType_QAsymmU8, 0.5, 1)
+
+ assert 2 == tensor_info.GetNumElements()
+ assert 3 == tensor_info.GetNumDimensions()
+ assert ann.DataType_QAsymmU8 == tensor_info.GetDataType()
+ assert 0.5 == tensor_info.GetQuantizationScale()
+ assert 1 == tensor_info.GetQuantizationOffset()
+
+ shape = tensor_info.GetShape()
+
+ assert 2 == shape.GetNumElements()
+ assert 3 == shape.GetNumDimensions()
+
+
+def test_tensor_info__str__():
+ tensor_info = ann.TensorInfo(ann.TensorShape((2, 3)), ann.DataType_QAsymmU8, 0.5, 1)
+
+ assert tensor_info.__str__() == "TensorInfo{DataType: 2, IsQuantized: 1, QuantizationScale: 0.500000, " \
+ "QuantizationOffset: 1, NumDimensions: 2, NumElements: 6}"