aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/test
diff options
context:
space:
mode:
authorPatrik Gustavsson <patrik.gustavsson@arm.com>2020-12-01 16:02:29 +0100
committerPatrik Gustavsson <patrik.gustavsson@arm.com>2020-12-18 16:33:32 +0100
commit2349d429d926e258e9a61d34c7fd97660ab9fb98 (patch)
treeb5151d0f12428e47d64b1fb2ce4f2f8c19304a0d /ethosu/vela/test
parent528a56df829b65f7a2c61953650b123c461095f7 (diff)
downloadethos-u-vela-2349d429d926e258e9a61d34c7fd97660ab9fb98.tar.gz
MLBEDSW-3654 Add/use op ifm/ofm shapes
Add ifm/ofm shapes to op Changed to rely on these shapes Signed-off-by: Patrik Gustavsson <patrik.gustavsson@arm.com> Change-Id: I571535a1dcadc2bdb04a3c727a8e1c49703b174d
Diffstat (limited to 'ethosu/vela/test')
-rw-r--r--ethosu/vela/test/test_graph_optimiser.py13
-rw-r--r--ethosu/vela/test/testutil.py5
2 files changed, 18 insertions, 0 deletions
diff --git a/ethosu/vela/test/test_graph_optimiser.py b/ethosu/vela/test/test_graph_optimiser.py
index 62a1b763..45377417 100644
--- a/ethosu/vela/test/test_graph_optimiser.py
+++ b/ethosu/vela/test/test_graph_optimiser.py
@@ -32,9 +32,16 @@ def test_convert_batched_fc():
weights = create_const_tensor("weight_in", shape, np.uint8, np.zeros(shape))
ofm = Tensor(ifm.shape, np.uint8, "test_out")
op = testutil.create_op(Op.FullyConnected, [ifm, weights], ofm)
+
ifm.consumer_list.append(op)
+ op.ifm_shapes.append([4, 1, 1, 8])
+ op.ofm_shapes.append([4, 1, 1, 8])
+
prev_op = op.clone()
+ prev_op.ifm_shapes = op.ifm_shapes
+ prev_op.ofm_shapes = op.ofm_shapes
+
conv_op = convert_batched_fc_shape(op, None, None)
assert conv_op.ifm != prev_op.ifm
@@ -51,7 +58,13 @@ def test_convert_batched_fc():
op = testutil.create_op(Op.FullyConnected, [ifm, weights], ofm)
ifm.consumer_list.append(op)
+ op.ifm_shapes.append([1, 1, 1, 8])
+ op.ofm_shapes.append([1, 1, 1, 8])
+
prev_op = op.clone()
+ prev_op.ifm_shapes = op.ifm_shapes
+ prev_op.ofm_shapes = op.ofm_shapes
+
conv_op = convert_batched_fc_shape(op, None, None)
assert conv_op.ifm == prev_op.ifm
diff --git a/ethosu/vela/test/testutil.py b/ethosu/vela/test/testutil.py
index 9ba39bc5..63f841b4 100644
--- a/ethosu/vela/test/testutil.py
+++ b/ethosu/vela/test/testutil.py
@@ -69,6 +69,8 @@ def create_elemwise_op(
ofm = Tensor(ofm_shape, datatype, name + "_ofm")
ofm.quantization = ofm_quant
op.set_output_tensor(ofm)
+ op.set_ifm_ofm_shapes()
+
return op
@@ -104,6 +106,8 @@ def create_op_with_quant_tensors(
qp.zero_point = np.zeros(bias_shape)
bias = create_const_tensor("bias", bias_shape, DataType.int32, np.zeros(bias_shape), np.int32, quantization=qp)
op.add_input_tensor(bias)
+
+ op.set_ifm_ofm_shapes()
return op
@@ -113,6 +117,7 @@ def create_op(op_type, inputs, output, attrs=None):
op.outputs = [output]
if attrs is not None:
op.attrs = attrs
+ op.set_ifm_ofm_shapes()
return op