aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/test
diff options
context:
space:
mode:
authorDwight Lidman <dwight.lidman@arm.com>2020-09-28 15:53:40 +0200
committerpatrik.gustavsson <patrik.gustavsson@arm.com>2020-10-12 07:02:26 +0000
commit8359a474e4f125382fd7b7d5431a612f6013f107 (patch)
tree50c5fc46f0b6117af77722a61edce19131b35e11 /ethosu/vela/test
parent04f8c009d17e339d5afd515a57f98c31e4297fe8 (diff)
downloadethos-u-vela-8359a474e4f125382fd7b7d5431a612f6013f107.tar.gz
MLBEDSW-3061: Update supported_operators.py
This commit changes and amends some parts of the restriction functions in order to make sure operators are correctly placed. Signed-off-by: Dwight Lidman <dwight.lidman@arm.com> Change-Id: I336cf33a874c9078a5bbf81ce129ff917dbc5e9a
Diffstat (limited to 'ethosu/vela/test')
-rw-r--r--ethosu/vela/test/test_supported_operators.py9
-rw-r--r--ethosu/vela/test/testutil.py24
2 files changed, 27 insertions, 6 deletions
diff --git a/ethosu/vela/test/test_supported_operators.py b/ethosu/vela/test/test_supported_operators.py
index 20d448d7..1fb452cf 100644
--- a/ethosu/vela/test/test_supported_operators.py
+++ b/ethosu/vela/test/test_supported_operators.py
@@ -30,11 +30,14 @@ support = SupportedOperators()
def create_strided_slice_op(in_shape, out_shape, start_offsets, end_offsets):
+ qp = QuantizationParameters()
in0 = Tensor(in_shape, DataType.uint8, "in")
- in1 = create_const_tensor("begin", [len(start_offsets)], DataType.uint8, start_offsets)
- in2 = create_const_tensor("end", [len(end_offsets)], DataType.uint8, end_offsets)
- in3 = create_const_tensor("strides", [len(end_offsets)], DataType.uint8, len(end_offsets) * [1])
+ in0.quantization = qp
+ in1 = create_const_tensor("begin", [len(start_offsets)], DataType.uint8, start_offsets, quantization=qp)
+ in2 = create_const_tensor("end", [len(end_offsets)], DataType.uint8, end_offsets, quantization=qp)
+ in3 = create_const_tensor("strides", [len(end_offsets)], DataType.uint8, len(end_offsets) * [1], quantization=qp)
out = Tensor(out_shape, DataType.uint8, "out")
+ out.quantization = qp
attrs = {"ellipsis_mask": 0, "new_axis_mask": 0, "shrink_axis_mask": 0, "begin_mask": 0, "end_mask": 0}
return testutil.create_op(Op.StridedSlice, [in0, in1, in2, in3], out, attrs=attrs)
diff --git a/ethosu/vela/test/testutil.py b/ethosu/vela/test/testutil.py
index adb874a0..c5ff0033 100644
--- a/ethosu/vela/test/testutil.py
+++ b/ethosu/vela/test/testutil.py
@@ -22,6 +22,7 @@ from ethosu.vela.data_type import DataType
from ethosu.vela.nn_graph import Subgraph
from ethosu.vela.operation import Operation
from ethosu.vela.tensor import create_const_tensor
+from ethosu.vela.tensor import QuantizationParameters
from ethosu.vela.tensor import Tensor
@@ -38,7 +39,17 @@ def create_arch():
)
-def create_elemwise_op(type, name, ifm_shape, ifm2_shape, ofm_shape, datatype=DataType.uint8):
+def create_elemwise_op(
+ type,
+ name,
+ ifm_shape,
+ ifm2_shape,
+ ofm_shape,
+ datatype=DataType.uint8,
+ ifm_quant=QuantizationParameters(),
+ ifm2_quant=QuantizationParameters(),
+ ofm_quant=QuantizationParameters(),
+):
# Creates elementwise operation with constant IFM/IFM2
if datatype.size_in_bytes() == 1:
np_type = np.uint8
@@ -47,9 +58,16 @@ def create_elemwise_op(type, name, ifm_shape, ifm2_shape, ofm_shape, datatype=Da
else:
np_type = np.int32
op = Operation(type, name)
- op.add_input_tensor(create_const_tensor(name + "_ifm", ifm_shape, datatype, np.zeros(ifm_shape), np_type))
- op.add_input_tensor(create_const_tensor(name + "_ifm2", ifm2_shape, datatype, np.zeros(ifm2_shape), np_type))
+ op.add_input_tensor(
+ create_const_tensor(name + "_ifm", ifm_shape, datatype, np.zeros(ifm_shape), np_type, quantization=ifm_quant)
+ )
+ op.add_input_tensor(
+ create_const_tensor(
+ name + "_ifm2", ifm2_shape, datatype, np.zeros(ifm2_shape), np_type, quantization=ifm2_quant
+ )
+ )
ofm = Tensor(ofm_shape, datatype, name + "_ofm")
+ ofm.quantization = ofm_quant
op.set_output_tensor(ofm)
return op