diff --git a/testdata/dnn/onnx/data/input_normalize_fusion.npy b/testdata/dnn/onnx/data/input_normalize_fusion.npy new file mode 100644 index 000000000..8cdfd0bff Binary files /dev/null and b/testdata/dnn/onnx/data/input_normalize_fusion.npy differ diff --git a/testdata/dnn/onnx/data/output_normalize_fusion.npy b/testdata/dnn/onnx/data/output_normalize_fusion.npy new file mode 100644 index 000000000..420aebbce Binary files /dev/null and b/testdata/dnn/onnx/data/output_normalize_fusion.npy differ diff --git a/testdata/dnn/onnx/generate_onnx_models.py b/testdata/dnn/onnx/generate_onnx_models.py index 8d5cc52c3..f017ad775 100644 --- a/testdata/dnn/onnx/generate_onnx_models.py +++ b/testdata/dnn/onnx/generate_onnx_models.py @@ -1245,3 +1245,16 @@ def forward(self, x): x = Variable(torch.randn([1, 1, 3, 4])) model = PadCalculation() save_data_and_model("calc_pads", x, model, version=11) + +class NormalizeFusion(nn.Module): + def forward(self, x): + mul = x * x + sum = torch.sum(mul, dim=(1), keepdim=True) + maximum = torch.clamp(sum, min=1e-8) + sqrt = torch.sqrt(maximum) + reciprocal = torch.reciprocal(sqrt) + return x * reciprocal + +x = Variable(torch.randn([2, 3])) +model = NormalizeFusion() +save_data_and_model("normalize_fusion", x, model) diff --git a/testdata/dnn/onnx/models/normalize_fusion.onnx b/testdata/dnn/onnx/models/normalize_fusion.onnx new file mode 100644 index 000000000..196c6808c Binary files /dev/null and b/testdata/dnn/onnx/models/normalize_fusion.onnx differ diff --git a/testdata/dnn/tensorflow/generate_tf_models.py b/testdata/dnn/tensorflow/generate_tf_models.py index 4194e10ca..4b4b8a6bc 100644 --- a/testdata/dnn/tensorflow/generate_tf_models.py +++ b/testdata/dnn/tensorflow/generate_tf_models.py @@ -497,6 +497,10 @@ def my_dropout(x): save(inp, flatten, 'unfused_flatten_unknown_batch', optimize=False) ################################################################################ inp = tf.placeholder(tf.float32, [1, 2, 3, 4], 'input') +leakyRelu = tf.nn.leaky_relu(inp, alpha=0.1) +save(inp, leakyRelu, 'leaky_relu', optimize=False) +################################################################################ +inp = tf.placeholder(tf.float32, [1, 2, 3, 4], 'input') relu = tf.maximum(inp, 0.01 * inp, name='leaky_relu') * 2 save(inp, relu, 'leaky_relu_order1', optimize=False) ################################################################################ diff --git a/testdata/dnn/tensorflow/leaky_relu_in.npy b/testdata/dnn/tensorflow/leaky_relu_in.npy new file mode 100644 index 000000000..3de9ab35b Binary files /dev/null and b/testdata/dnn/tensorflow/leaky_relu_in.npy differ diff --git a/testdata/dnn/tensorflow/leaky_relu_net.pb b/testdata/dnn/tensorflow/leaky_relu_net.pb new file mode 100644 index 000000000..35cbde4e4 Binary files /dev/null and b/testdata/dnn/tensorflow/leaky_relu_net.pb differ diff --git a/testdata/dnn/tensorflow/leaky_relu_out.npy b/testdata/dnn/tensorflow/leaky_relu_out.npy new file mode 100644 index 000000000..8fb9202a2 Binary files /dev/null and b/testdata/dnn/tensorflow/leaky_relu_out.npy differ diff --git a/testdata/perf/objdetect.xml b/testdata/perf/objdetect.xml index 1e1f332ed..190cc3600 100644 --- a/testdata/perf/objdetect.xml +++ b/testdata/perf/objdetect.xml @@ -696,7 +696,7 @@ 97 81 113 100 113 101 99 113 37 104 114 101 51 63 74 88 65536 - 5 + 0 0. 255. @@ -723,7 +723,7 @@ 97 81 113 100 113 101 99 113 37 104 114 101 51 63 74 88 65536 - 5 + 0 0. 255. @@ -750,7 +750,7 @@ 97 81 113 100 113 101 99 113 37 104 114 101 51 63 74 88 65536 - 5 + 0 0. 255. @@ -777,7 +777,7 @@ 97 81 113 100 113 101 99 113 37 104 114 101 51 63 74 88 65536 - 5 + 0 0. 255. @@ -804,7 +804,7 @@ 97 81 113 100 113 101 99 113 37 104 114 101 51 63 74 88 65536 - 5 + 0 0. 255. @@ -839,7 +839,7 @@ 94. 65536 - 5 + 0 0. 255. @@ -874,7 +874,7 @@ 56. 65536 - 5 + 0 0. 255. @@ -909,7 +909,7 @@ 51. 65536 - 5 + 0 0. 255. @@ -944,7 +944,7 @@ 85. 65536 - 5 + 0 0. 255. @@ -979,7 +979,7 @@ 67. 65536 - 5 + 0 0. 255. @@ -1014,7 +1014,7 @@ 32. 65536 - 5 + 0 0. 255. @@ -1049,7 +1049,7 @@ 134. 65536 - 5 + 0 0. 255. @@ -1084,7 +1084,7 @@ 47. 65536 - 5 + 0 0. 255. @@ -1112,7 +1112,7 @@ 103 47 65536 - 5 + 0 0. 255. @@ -1147,7 +1147,7 @@ 112. 65536 - 5 + 0 0. 255. @@ -1321,7 +1321,7 @@ 105. 327680 - 5 + 0 2 1 0. @@ -1352,7 +1352,7 @@ 73 32 76 111 118 101 32 79 112 101 110 67 86 327680 - 5 + 0 2 0 0. @@ -1383,7 +1383,7 @@ 73 32 76 111 118 101 32 79 112 101 110 67 86 327680 - 5 + 0 3 1 0. @@ -1422,7 +1422,7 @@ 110. 327680 - 5 + 0 4 1 0. @@ -1461,7 +1461,7 @@ 112. 327680 - 5 + 0 5 4 0. @@ -1492,7 +1492,7 @@ 69 88 84 82 65 327680 - 5 + 0 6 4 0. @@ -1531,7 +1531,7 @@ 103. 327680 - 5 + 0 7 1 0. @@ -1562,7 +1562,7 @@ 80 111 108 105 110 97 327680 - 5 + 0 8 5 0.