From a5333a9b989cd63ae0d4603ce3e2ac8d3e960144 Mon Sep 17 00:00:00 2001 From: dlyakhov Date: Wed, 31 Jul 2024 14:20:46 +0200 Subject: [PATCH] Tests --- .../scaled_dot_product_attention.dot | 70 +++++++++++++++---- tests/openvino/native/models.py | 8 ++- 2 files changed, 65 insertions(+), 13 deletions(-) diff --git a/tests/openvino/native/data/2024.1/reference_graphs/quantized/scaled_dot_product_attention.dot b/tests/openvino/native/data/2024.1/reference_graphs/quantized/scaled_dot_product_attention.dot index 3e2cecf2c4f..4fa4a752a26 100644 --- a/tests/openvino/native/data/2024.1/reference_graphs/quantized/scaled_dot_product_attention.dot +++ b/tests/openvino/native/data/2024.1/reference_graphs/quantized/scaled_dot_product_attention.dot @@ -1,17 +1,63 @@ strict digraph { "0 Input_1" [id=0, type=Parameter]; "1 Input_2" [id=1, type=Parameter]; -"2 Reshape_20" [id=2, type=Reshape]; -"3 ScaledDotProductAttention_23" [id=3, type=ScaledDotProductAttention]; -"4 Reshape_22" [id=4, type=Reshape]; +"2 Reshape_3835" [id=2, type=Reshape]; +"3 ScaledDotProductAttention_3850" [id=3, type=ScaledDotProductAttention]; +"4 Reshape_3837" [id=4, type=Reshape]; "5 Result" [id=5, type=Result]; -"6 Constant_21" [id=6, type=Constant]; -"7 Constant_19" [id=7, type=Constant]; -"0 Input_1" -> "2 Reshape_20" [label="[1, 1, 1, 64]", style=solid]; -"1 Input_2" -> "3 ScaledDotProductAttention_23" [label="[1, 1, 1, 1]", style=solid]; -"2 Reshape_20" -> "4 Reshape_22" [label="[64]", style=solid]; -"3 ScaledDotProductAttention_23" -> "5 Result" [label="[1, 1, 1, 64]", style=solid]; -"4 Reshape_22" -> "3 ScaledDotProductAttention_23" [label="parallel_input_port_ids:[1, 2], shape:[1, 1, 1, 64]", style=solid]; -"6 Constant_21" -> "4 Reshape_22" [label="[4]", style=dashed]; -"7 Constant_19" -> "2 Reshape_20" [label="[1]", style=dashed]; +"6 Reshape_3839/fq_input_0" [id=6, type=FakeQuantize]; +"7 Reshape_3843/fq_input_0" [id=7, type=FakeQuantize]; +"8 Reshape_3847" [id=8, type=Reshape]; +"9 Reshape_3839" [id=9, type=Reshape]; +"10 Reshape_3843" [id=10, type=Reshape]; +"11 Reshape_3849" [id=11, type=Reshape]; +"12 Reshape_3841" [id=12, type=Reshape]; +"13 Reshape_3845" [id=13, type=Reshape]; +"14 Constant_3848" [id=14, type=Constant]; +"15 Constant_3846" [id=15, type=Constant]; +"16 Constant_3836" [id=16, type=Constant]; +"17 Constant_3834" [id=17, type=Constant]; +"18 Constant_3844" [id=18, type=Constant]; +"19 Constant_3842" [id=19, type=Constant]; +"20 Reshape_3843/fq_input_0/output_high" [id=20, type=Constant]; +"21 Reshape_3843/fq_input_0/output_low" [id=21, type=Constant]; +"22 Reshape_3843/fq_input_0/input_high" [id=22, type=Constant]; +"23 Reshape_3843/fq_input_0/input_low" [id=23, type=Constant]; +"24 Constant_3840" [id=24, type=Constant]; +"25 Constant_3838" [id=25, type=Constant]; +"26 Reshape_3839/fq_input_0/output_high" [id=26, type=Constant]; +"27 Reshape_3839/fq_input_0/output_low" [id=27, type=Constant]; +"28 Reshape_3839/fq_input_0/input_high" [id=28, type=Constant]; +"29 Reshape_3839/fq_input_0/input_low" [id=29, type=Constant]; +"0 Input_1" -> "2 Reshape_3835" [label="[1, 1, 1, 64]", style=solid]; +"1 Input_2" -> "3 ScaledDotProductAttention_3850" [label="[1, 1, 1, 1]", style=solid]; +"2 Reshape_3835" -> "4 Reshape_3837" [label="[64]", style=solid]; +"3 ScaledDotProductAttention_3850" -> "5 Result" [label="[1, 1, 1, 64]", style=solid]; +"4 Reshape_3837" -> "6 Reshape_3839/fq_input_0" [label="[1, 1, 1, 64]", style=solid]; +"4 Reshape_3837" -> "7 Reshape_3843/fq_input_0" [label="[1, 1, 1, 64]", style=solid]; +"4 Reshape_3837" -> "8 Reshape_3847" [label="[1, 1, 1, 64]", style=solid]; +"6 Reshape_3839/fq_input_0" -> "9 Reshape_3839" [label="[1, 1, 1, 64]", style=solid]; +"7 Reshape_3843/fq_input_0" -> "10 Reshape_3843" [label="[1, 1, 1, 64]", style=solid]; +"8 Reshape_3847" -> "11 Reshape_3849" [label="[64]", style=solid]; +"9 Reshape_3839" -> "12 Reshape_3841" [label="[64]", style=solid]; +"10 Reshape_3843" -> "13 Reshape_3845" [label="[64]", style=solid]; +"11 Reshape_3849" -> "3 ScaledDotProductAttention_3850" [label="[1, 1, 1, 64]", style=solid]; +"12 Reshape_3841" -> "3 ScaledDotProductAttention_3850" [label="[1, 1, 1, 64]", style=solid]; +"13 Reshape_3845" -> "3 ScaledDotProductAttention_3850" [label="[1, 1, 1, 64]", style=solid]; +"14 Constant_3848" -> "11 Reshape_3849" [label="[4]", style=dashed]; +"15 Constant_3846" -> "8 Reshape_3847" [label="[1]", style=dashed]; +"16 Constant_3836" -> "4 Reshape_3837" [label="[4]", style=dashed]; +"17 Constant_3834" -> "2 Reshape_3835" [label="[1]", style=dashed]; +"18 Constant_3844" -> "13 Reshape_3845" [label="[4]", style=dashed]; +"19 Constant_3842" -> "10 Reshape_3843" [label="[1]", style=dashed]; +"20 Reshape_3843/fq_input_0/output_high" -> "7 Reshape_3843/fq_input_0" [label="[]", style=solid]; +"21 Reshape_3843/fq_input_0/output_low" -> "7 Reshape_3843/fq_input_0" [label="[]", style=solid]; +"22 Reshape_3843/fq_input_0/input_high" -> "7 Reshape_3843/fq_input_0" [label="[]", style=solid]; +"23 Reshape_3843/fq_input_0/input_low" -> "7 Reshape_3843/fq_input_0" [label="[]", style=solid]; +"24 Constant_3840" -> "12 Reshape_3841" [label="[4]", style=dashed]; +"25 Constant_3838" -> "9 Reshape_3839" [label="[1]", style=dashed]; +"26 Reshape_3839/fq_input_0/output_high" -> "6 Reshape_3839/fq_input_0" [label="[]", style=solid]; +"27 Reshape_3839/fq_input_0/output_low" -> "6 Reshape_3839/fq_input_0" [label="[]", style=solid]; +"28 Reshape_3839/fq_input_0/input_high" -> "6 Reshape_3839/fq_input_0" [label="[]", style=solid]; +"29 Reshape_3839/fq_input_0/input_low" -> "6 Reshape_3839/fq_input_0" [label="[]", style=solid]; } diff --git a/tests/openvino/native/models.py b/tests/openvino/native/models.py index 3988bc8e622..df79fecffe3 100644 --- a/tests/openvino/native/models.py +++ b/tests/openvino/native/models.py @@ -876,7 +876,13 @@ def _create_ov_model(self): x = opset.reshape(input_, [64], False) x = opset.reshape(x, [1, 1, 1, 64], False) - attn = opset.scaled_dot_product_attention(x, x, x, attn_mask) + inputs = [] + for _ in range(3): + x_ = opset.reshape(x, [64], False) + x_ = opset.reshape(x_, [1, 1, 1, 64], False) + inputs.append(x_) + + attn = opset.scaled_dot_product_attention(*inputs, attn_mask) result = opset.result(attn, name="Result") result.get_output_tensor(0).set_names(set(["Result"])) model = ov.Model([result], [input_, attn_mask])