aboutsummaryrefslogtreecommitdiff
path: root/python/pyarmnn/test/test_tensor_info.py
diff options
context:
space:
mode:
authorMatthew Bentham <Matthew.Bentham@arm.com>2019-12-02 12:59:43 +0000
committerMatthew Bentham <Matthew.Bentham@arm.com>2019-12-02 16:23:45 +0000
commit245d64c60d0ea30f5080ff53225b5169927e24d6 (patch)
treed623e46d7d5ddb34ef3bb84c45df3ada9209ce82 /python/pyarmnn/test/test_tensor_info.py
parent88d5f9f1615fa956464b8932b574d85c37cec937 (diff)
downloadarmnn-experimental/pyarmnn.tar.gz
Work in progress of python bindings for Arm NNexperimental/pyarmnn
Not built or tested in any way Signed-off-by: Matthew Bentham <Matthew.Bentham@arm.com> Change-Id: Ie7f92b529aa5087130f0c5cc8c17db1581373236
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..224f9d4ea9
--- /dev/null
+++ b/python/pyarmnn/test/test_tensor_info.py
@@ -0,0 +1,27 @@
+# Copyright © 2019 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_QuantisedAsymm8, 0.5, 1)
+
+ assert 2 == tensor_info.GetNumElements()
+ assert 3 == tensor_info.GetNumDimensions()
+ assert ann.DataType_QuantisedAsymm8 == 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_QuantisedAsymm8, 0.5, 1)
+
+ assert tensor_info.__str__() == "TensorInfo{DataType: 2, IsQuantized: 1, QuantizationScale: 0.500000, " \
+ "QuantizationOffset: 1, NumDimensions: 2, NumElements: 6}"