diff options
Diffstat (limited to 'ethosu/vela/test')
-rw-r--r-- | ethosu/vela/test/test_graph_optimiser.py | 13 | ||||
-rw-r--r-- | ethosu/vela/test/testutil.py | 5 |
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 |