From b8107c1f599a1c748e2bfd8352b8a1eb16b34962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9COpenvino-dev-contest=E2=80=9D?= Date: Mon, 23 May 2022 23:12:56 +0800 Subject: [PATCH 1/7] add paddle op top_k_v2 --- src/core/tests/frontend/paddle/op_fuzzy.cpp | 400 ------------------ .../gen_scripts/generate_top_k_v2.py | 49 +++ src/frontends/paddle/src/op/top_k_v2.cpp | 42 ++ src/frontends/paddle/src/op_table.cpp | 2 + 4 files changed, 93 insertions(+), 400 deletions(-) delete mode 100644 src/core/tests/frontend/paddle/op_fuzzy.cpp create mode 100644 src/core/tests/frontend/paddle/test_models/gen_scripts/generate_top_k_v2.py create mode 100644 src/frontends/paddle/src/op/top_k_v2.cpp diff --git a/src/core/tests/frontend/paddle/op_fuzzy.cpp b/src/core/tests/frontend/paddle/op_fuzzy.cpp deleted file mode 100644 index dd75116896bd6e..00000000000000 --- a/src/core/tests/frontend/paddle/op_fuzzy.cpp +++ /dev/null @@ -1,400 +0,0 @@ -// Copyright (C) 2018-2022 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "op_fuzzy.hpp" - -#include - -#include - -#include "engines_util/test_engines.hpp" -#include "ngraph/ngraph.hpp" -#include "paddle_utils.hpp" -#include "util/test_control.hpp" - -using namespace ngraph; -using namespace InferenceEngine; -using namespace ngraph; -using namespace ov::frontend; - -using PaddleFuzzyOpTest = FrontEndFuzzyOpTest; - -static const std::vector models{ - std::string("argmax"), - std::string("argmax1"), - std::string("assign_none/assign_none.pdmodel"), - std::string("assign_output/assign_output.pdmodel"), - std::string("assign_value_boolean"), - std::string("assign_value_fp32"), - std::string("assign_value_int32"), - std::string("assign_value_int64"), - std::string("avgAdaptivePool2D_test1"), - std::string("avgPool_test1"), - std::string("avgPool_test10"), - std::string("avgPool_test11"), - std::string("avgPool_test2"), - std::string("avgPool_test3"), - std::string("avgPool_test4"), - std::string("avgPool_test5"), - // avgPool_test6, - std::string("avgPool_test7"), - std::string("avgPool_test8"), - std::string("avgPool_test9"), - std::string("batch_norm_nchw"), - std::string("batch_norm_nhwc"), - std::string("bicubic_downsample_false_0"), - std::string("bicubic_downsample_false_1"), - std::string("bicubic_downsample_true_0"), - std::string("bicubic_upsample_false_0"), - std::string("bicubic_upsample_false_1"), - std::string("bicubic_upsample_scales"), - std::string("bicubic_upsample_scales2"), - std::string("bicubic_upsample_true_0"), - std::string("bilinear_downsample_false_0"), - std::string("bilinear_downsample_false_1"), - std::string("bilinear_downsample_true_0"), - std::string("bilinear_upsample_false_0"), - std::string("bilinear_upsample_false_1"), - std::string("bilinear_upsample_scales"), - std::string("bilinear_upsample_scales2"), - std::string("bilinear_upsample_true_0"), - std::string("bmm"), - std::string("clip"), - std::string("conv2d_dilation_assymetric_pads_strides"), - std::string("conv2d_SAME_padding"), - std::string("conv2d_strides_assymetric_padding"), - std::string("conv2d_strides_no_padding"), - std::string("conv2d_strides_padding"), - std::string("conv2d_transpose_dilation_assymetric_pads_strides"), - // conv2d_transpose_SAME_padding(Paddle outputs wrong results), - std::string("conv2d_transpose_strides_assymetric_padding"), - std::string("conv2d_transpose_strides_no_padding"), - std::string("conv2d_transpose_strides_padding"), - std::string("conv2d_transpose_VALID_padding"), - std::string("conv2d_VALID_padding"), - std::string("cumsum"), - std::string("cumsum_i32"), - std::string("cumsum_i64"), - std::string("cumsum_f32"), - std::string("cumsum_f64"), - std::string("depthwise_conv2d_convolution"), - std::string("depthwise_conv2d_transpose_convolution"), - std::string("dropout"), - std::string("dropout_upscale_in_train"), - std::string("elementwise_add1"), - std::string("elementwise_div1"), - std::string("elementwise_max1"), - std::string("elementwise_min1"), - std::string("elementwise_mul1"), - std::string("elementwise_pow1"), - std::string("elementwise_sub1"), - std::string("elementwise_add2"), - std::string("elementwise_div2"), - std::string("elementwise_max2"), - std::string("elementwise_min2"), - std::string("elementwise_mul2"), - std::string("elementwise_pow2"), - std::string("elementwise_sub2"), - std::string("elementwise_add3"), - std::string("elementwise_div3"), - std::string("elementwise_max3"), - std::string("elementwise_min3"), - std::string("elementwise_mul3"), - std::string("elementwise_pow3"), - std::string("elementwise_sub3"), - std::string("elementwise_add4"), - std::string("elementwise_div4"), - std::string("elementwise_max4"), - std::string("elementwise_min4"), - std::string("elementwise_mul4"), - std::string("elementwise_pow4"), - std::string("elementwise_sub4"), - std::string("embedding_0"), - std::string("embedding_sparse"), - std::string("embedding_none_weight"), - std::string("embedding_paddings"), - std::string("embedding_paddings_neg1"), - std::string("embedding_tensorIds"), - std::string("embedding_tensorIds_paddings"), - std::string("equal"), - std::string("expand_v2"), - std::string("expand_v2_tensor"), - std::string("expand_v2_tensor_list"), - std::string("expand_v2_tensor_list2"), - std::string("exp_test_float32"), - std::string("fill_any_like"), - std::string("fill_any_like_f16"), - std::string("fill_any_like_f32"), - std::string("fill_any_like_f64"), - std::string("fill_any_like_i32"), - std::string("fill_any_like_i64"), - std::string("fill_constant"), - std::string("fill_constant_batch_size_like"), - std::string("fill_constant_int32"), - std::string("fill_constant_int64"), - std::string("fill_constant_tensor"), - std::string("fill_constant_shape_tensor"), - std::string("fill_constant_shape_tensor_list"), - std::string("flatten_contiguous_range_test1"), - std::string("floor_float32"), - std::string("gather_multi_dimension"), - std::string("gather_one_dimension"), - std::string("gather_one_dimension2"), - // gather_axis_input - // (CVS-82724: not support Axis as input), - std::string("gelu_erf"), - std::string("gelu_tanh"), - std::string("generate_proposals_v2_0"), - std::string("generate_proposals_v2_1"), - std::string("generate_proposals_v2_2"), - std::string("generate_proposals_v2_3"), - std::string("generate_proposals_v2_4"), - std::string("generate_proposals_v2_5"), - std::string("generate_proposals_v2_6"), - // greater_equal_big_int64(failure due to CPU inference), - std::string("greater_equal_big_int64"), - std::string("greater_equal_float32"), - std::string("greater_equal_int32"), - std::string("greater_equal_int64"), - std::string("greater_than_float32"), - std::string("greater_than_int32"), - std::string("greater_than_int64"), - std::string("hard_sigmoid"), - std::string("hard_swish"), - std::string("layer_norm"), - std::string("layer_norm_noall"), - std::string("layer_norm_noscale"), - std::string("layer_norm_noshift"), - std::string("leaky_relu"), - std::string("less_than_float32"), - std::string("less_than_int32"), - std::string("less_than_int64"), - std::string("linear_downsample_false_0"), - std::string("linear_downsample_false_1"), - std::string("linear_downsample_true_0"), - std::string("linear_upsample_false_0"), - std::string("linear_upsample_false_1"), - std::string("linear_upsample_scales"), - std::string("linear_upsample_scales2"), - std::string("linear_upsample_true_0"), - std::string("log"), - std::string("logical_and"), - std::string("logical_not"), - std::string("logical_or"), - std::string("logical_xor"), - std::string("matmul_xt"), - std::string("matmul_xt_yt"), - std::string("matmul_yt"), - std::string("matmul_v2_1dx1d"), - std::string("matmul_v2_1dx2d"), - std::string("matmul_v2_2dx1d"), - std::string("matmul_v2_ndxmd"), - std::string("matmul_v2_xt"), - std::string("matmul_v2_xt_yt"), - std::string("matmul_v2_yt"), - std::string("matrix_nms_by_background"), - std::string("matrix_nms_by_keep_top_k"), - std::string("matrix_nms_by_nms_top_k"), - std::string("matrix_nms_by_post_threshold"), - std::string("matrix_nms_flipped_coordinates"), - std::string("matrix_nms_gaussian"), - std::string("matrix_nms_gaussian_sigma"), - std::string("matrix_nms_identical_boxes"), - std::string("matrix_nms_not_normalized"), - std::string("matrix_nms_not_return_indexed"), - std::string("matrix_nms_not_return_rois_num"), - std::string("matrix_nms_not_return_rois_num_neither_index"), - std::string("matrix_nms_one_batch"), - std::string("matrix_nms_single_box"), - std::string("matrix_nms_two_batches_two_classes"), - std::string("matrix_nms_normalized_random"), - std::string("matrix_nms_not_normalized_random"), - std::string("maxAdaptivePool2D_test1"), - std::string("maxPool_test1"), - std::string("maxPool_test10"), - std::string("maxPool_test11"), - std::string("maxPool_test2"), - std::string("maxPool_test3"), - std::string("maxPool_test4"), - std::string("maxPool_test5"), - // maxPool_test6(nchw support is disabled now), - std::string("maxPool_test7"), - std::string("maxPool_test8"), - std::string("maxPool_test9"), - std::string("meshgrid/meshgrid.pdmodel"), - std::string("multiclass_nms_by_background"), - std::string("multiclass_nms_by_class_id"), - std::string("multiclass_nms_by_IOU"), - std::string("multiclass_nms_by_IOU_and_scores"), - std::string("multiclass_nms_by_keep_top_k"), - std::string("multiclass_nms_by_nms_eta"), - std::string("multiclass_nms_by_nms_top_k"), - std::string("multiclass_nms_flipped_coordinates"), - std::string("multiclass_nms_identical_boxes"), - // default - std::string("multiclass_nms_lod_roisnum_multiple_images_default"), - std::string("multiclass_nms_lod_roisnum_multiple_images_0_default"), - std::string("multiclass_nms_lod_roisnum_single_image_default"), - // background - std::string("multiclass_nms_lod_roisnum_multiple_images_background"), - std::string("multiclass_nms_lod_roisnum_multiple_images_0_background"), - std::string("multiclass_nms_lod_roisnum_single_image_background"), - // score_threshold - std::string("multiclass_nms_lod_roisnum_multiple_images_score_threshold"), - std::string("multiclass_nms_lod_roisnum_multiple_images_0_score_threshold"), - std::string("multiclass_nms_lod_roisnum_single_image_score_threshold"), - // nms_top_k - std::string("multiclass_nms_lod_roisnum_multiple_images_nms_top_k"), - std::string("multiclass_nms_lod_roisnum_multiple_images_0_nms_top_k"), - std::string("multiclass_nms_lod_roisnum_single_image_nms_top_k"), - // keep_top_k - std::string("multiclass_nms_lod_roisnum_multiple_images_keep_top_k"), - std::string("multiclass_nms_lod_roisnum_multiple_images_0_keep_top_k"), - std::string("multiclass_nms_lod_roisnum_single_image_keep_top_k"), - // normalized - std::string("multiclass_nms_lod_roisnum_multiple_images_normalized"), - std::string("multiclass_nms_lod_roisnum_multiple_images_0_normalized"), - std::string("multiclass_nms_lod_roisnum_single_image_normalized"), - std::string("multiclass_nms_not_normalized"), - std::string("multiclass_nms_not_return_indexed"), - std::string("multiclass_nms_single_box"), - std::string("multiclass_nms_two_batches_two_classes_by_class_id"), - std::string("multiclass_nms_normalized_random"), - std::string("multiclass_nms_not_normalized_random"), - std::string("nearest_downsample_false_0"), - std::string("nearest_downsample_false_1"), - std::string("nearest_upsample_false_0"), - std::string("nearest_upsample_false_1"), - std::string("pad3d_test1"), - std::string("pad3d_test2"), - std::string("pad3d_test3"), - // pad3d_test4, - std::string("pow_float32"), - std::string("pow_int32"), - std::string("pow_int64"), - // pow_int64_out_of_range(out of range of OV int64), - std::string("pow_y_tensor"), - std::string("prior_box_attrs_mmar_order_true"), - std::string("prior_box_default"), - std::string("prior_box_flip_clip_false"), - std::string("prior_box_max_sizes_none"), - std::string("range0"), - std::string("range1"), - std::string("range2"), - std::string("reduce_max_test_0"), - std::string("reduce_max_test_1"), - std::string("reduce_max_test_2"), - std::string("reduce_max_test_3"), - std::string("reduce_max_test_4"), - std::string("reduce_max_test_5"), - std::string("reduce_mean_test_0"), - std::string("reduce_mean_test_1"), - std::string("reduce_mean_test_2"), - std::string("reduce_mean_test_3"), - std::string("reduce_mean_test_4"), - std::string("reduce_mean_test_5"), - std::string("reduce_min_test_0"), - std::string("reduce_min_test_1"), - std::string("reduce_min_test_2"), - std::string("reduce_min_test_3"), - std::string("reduce_min_test_4"), - std::string("reduce_min_test_5"), - std::string("reduce_prod_test_0"), - std::string("reduce_prod_test_1"), - std::string("reduce_prod_test_2"), - std::string("reduce_prod_test_3"), - std::string("reduce_prod_test_4"), - std::string("reduce_prod_test_5"), - std::string("reduce_sum_test_0"), - std::string("reduce_sum_test_1"), - std::string("reduce_sum_test_2"), - std::string("reduce_sum_test_3"), - std::string("reduce_sum_test_4"), - std::string("reduce_sum_test_5"), - std::string("relu"), - std::string("relu6"), - std::string("relu6_1"), - std::string("reshape"), - std::string("reshape_tensor"), - std::string("reshape_tensor_list"), - std::string("rnn_lstm_layer_1_bidirectional"), - std::string("rnn_lstm_layer_1_forward"), - std::string("rnn_lstm_layer_2_bidirectional"), - std::string("rnn_lstm_layer_2_forward"), - std::string("rnn_lstm_layer_1_forward_seq_len_4"), - std::string("rnn_lstm_layer_2_bidirectional_seq_len_4"), - std::string("roi_align_test"), - std::string("roi_align_test2"), - std::string("scale_bias_after_float32"), - std::string("scale_bias_after_int32"), - std::string("scale_bias_after_int64"), - std::string("scale_bias_before_float32"), - std::string("scale_bias_before_int32"), - std::string("scale_bias_before_int64"), - std::string("scale_tensor_bias_after"), - std::string("scale_tensor_bias_before"), - std::string("shape"), - std::string("sigmoid"), - std::string("slice"), - std::string("slice_1d"), - std::string("slice_decrease_axis/slice_decrease_axis.pdmodel"), - std::string("slice_decrease_axis_all/slice_decrease_axis_all.pdmodel"), - std::string("slice_reshape/slice_reshape.pdmodel"), - std::string("softmax"), - std::string("softmax_minus"), - std::string("softplus_default_params"), - std::string("split_test1"), - std::string("split_test2"), - std::string("split_test3"), - std::string("split_test4"), - std::string("split_test5"), - std::string("split_test6"), - std::string("split_test_dim_int32"), - std::string("split_test_dim_int64"), - std::string("split_test_list"), - std::string("split_test_list_tensor"), - std::string("sqrt_float32"), - std::string("squeeze"), - std::string("squeeze_null_axes"), - std::string("stack_test_float32"), - std::string("stack_test_int32"), - std::string("stack_test_neg_axis"), - std::string("stack_test_none_axis"), - std::string("strided_slice_input1_1"), - std::string("strided_slice_input1_2"), - std::string("strided_slice_input1_3"), - std::string("strided_slice_input1_4"), - std::string("strided_slice_input2_1"), - std::string("strided_slice_input2_2"), - std::string("strided_slice_input2_3"), - std::string("strided_slice_input3_1"), - std::string("strided_slice_input3_2"), - std::string("swish_default_params"), - std::string("swish_beta"), - std::string("tanh"), - std::string("trilinear_downsample_false_0"), - std::string("trilinear_downsample_false_1"), - std::string("trilinear_downsample_true_0"), - std::string("trilinear_upsample_false_0"), - std::string("trilinear_upsample_false_1"), - std::string("trilinear_upsample_scales"), - std::string("trilinear_upsample_scales2"), - std::string("trilinear_upsample_true_0"), - std::string("unsqueeze"), - std::string("where_1"), - std::string("where_2"), - std::string("where_3"), - // Temporily disable them until root caused to secure CI stable. - // CVS-66703 to track this. - // std::string("yolo_box_clip_box"), - // std::string("yolo_box_default"), - // std::string("yolo_box_scale_xy"), - std::string("yolo_box_uneven_wh")}; - -INSTANTIATE_TEST_SUITE_P(PaddleFuzzyOpTest, - FrontEndFuzzyOpTest, - ::testing::Combine(::testing::Values(PADDLE_FE), - ::testing::Values(std::string(TEST_PADDLE_MODELS_DIRNAME)), - ::testing::ValuesIn(models)), - PaddleFuzzyOpTest::getTestCaseName); diff --git a/src/core/tests/frontend/paddle/test_models/gen_scripts/generate_top_k_v2.py b/src/core/tests/frontend/paddle/test_models/gen_scripts/generate_top_k_v2.py new file mode 100644 index 00000000000000..28e9320f6aa052 --- /dev/null +++ b/src/core/tests/frontend/paddle/test_models/gen_scripts/generate_top_k_v2.py @@ -0,0 +1,49 @@ +# +# top_k_v2 paddle model generator +# +import numpy as np +from save_model import saveModel +import paddle +import sys + +data_type = 'float32' + + +def top_k_v2(name: str, x, k: int, axis=None, largest=True, sorted=True): + + paddle.enable_static() + + with paddle.static.program_guard(paddle.static.Program(), paddle.static.Program()): + node_x = paddle.static.data(name='x', shape=x.shape, dtype='float32') + value, indices = paddle.topk( + node_x, k=k, axis=axis, largest=largest, sorted=sorted, name="top_k") + indices = paddle.cast(indices, np.float32) + + cpu = paddle.static.cpu_places(1) + exe = paddle.static.Executor(cpu[0]) + # startup program will call initializer to initialize the parameters. + exe.run(paddle.static.default_startup_program()) + + outs = exe.run( + feed={'x': x}, + fetch_list=[value, indices]) + + saveModel(name, exe, feedkeys=['x'], fetchlist=[value, indices], inputs=[ + x], outputs=outs, target_dir=sys.argv[1]) + + return outs[0] + + +def main(): + data = np.random.random([8, 9, 10]).astype("float32") + # sorted must be true + top_k_v2("top_k_v2_test_1", data, k=5, axis=-2, largest=True, sorted=True) + top_k_v2("top_k_v2_test_2", data, k=6, axis=-1, largest=True, sorted=True) + top_k_v2("top_k_v2_test_3", data, k=4, axis=0, largest=False, sorted=True) + top_k_v2("top_k_v2_test_4", data, k=7, + axis=None, largest=True, sorted=True) + top_k_v2("top_k_v2_test_5", data, k=6, axis=2, largest=False, sorted=True) + + +if __name__ == "__main__": + main() diff --git a/src/frontends/paddle/src/op/top_k_v2.cpp b/src/frontends/paddle/src/op/top_k_v2.cpp new file mode 100644 index 00000000000000..b4724026859baf --- /dev/null +++ b/src/frontends/paddle/src/op/top_k_v2.cpp @@ -0,0 +1,42 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// +#include "default_opset.hpp" +#include "openvino/frontend/paddle/node_context.hpp" + +namespace ov { +namespace frontend { +namespace paddle { +namespace op { +NamedOutputs top_k_v2(const NodeContext& node) { + auto x = node.get_input("X"); + Output k_expected_node; + if (node.has_input("K")) { + auto k_variable = node.get_input("K"); + k_expected_node = std::make_shared(k_variable, element::i32); + } else { + const auto k_expected = node.get_attribute("k", 1); + k_expected_node = default_opset::Constant::create(element::i32, {}, {k_expected}); + } + + auto axis = node.get_attribute("axis"); + bool sorted = node.get_attribute("sorted"); + bool largest = node.get_attribute("largest"); + const element::Type& index_element_type = element::i32; + + std::string sort_type = sorted ? "value" : "none"; + std::string mode = largest ? "max" : "min"; + + auto node_topk = + std::make_shared(x, k_expected_node, axis, mode, sort_type, index_element_type); + + NamedOutputs named_outputs; + named_outputs["Out"] = OutputVector{node_topk->output(0)}; + named_outputs["Indices"] = OutputVector{node_topk->output(1)}; + + return named_outputs; +} +} // namespace op +} // namespace paddle +} // namespace frontend +} // namespace ov diff --git a/src/frontends/paddle/src/op_table.cpp b/src/frontends/paddle/src/op_table.cpp index cb4b28c583de4b..657ae8fd8c6207 100644 --- a/src/frontends/paddle/src/op_table.cpp +++ b/src/frontends/paddle/src/op_table.cpp @@ -87,6 +87,7 @@ OP_CONVERTER(stack); OP_CONVERTER(strided_slice); OP_CONVERTER(swish); OP_CONVERTER(tanh); +OP_CONVERTER(top_k_v2); OP_CONVERTER(transpose2); OP_CONVERTER(trilinear_interp_v2); OP_CONVERTER(unsqueeze); @@ -182,6 +183,7 @@ std::map get_supported_ops() { {"swish", op::swish}, {"sync_batch_norm", op::batch_norm}, {"tanh", op::tanh}, + {"top_k_v2", op::top_k_v2}, {"transpose2", op::transpose2}, {"trilinear_interp_v2", op::trilinear_interp_v2}, {"unsqueeze2", op::unsqueeze}, From 30a94dcc14bf589488be7a9257878ac1e9da9922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9COpenvino-dev-contest=E2=80=9D?= Date: Tue, 31 May 2022 19:52:22 +0800 Subject: [PATCH 2/7] rebase --- src/core/tests/frontend/paddle/op_fuzzy.cpp | 405 ++++++++++++++++++++ 1 file changed, 405 insertions(+) create mode 100644 src/core/tests/frontend/paddle/op_fuzzy.cpp diff --git a/src/core/tests/frontend/paddle/op_fuzzy.cpp b/src/core/tests/frontend/paddle/op_fuzzy.cpp new file mode 100644 index 00000000000000..bfdbea5dd825d6 --- /dev/null +++ b/src/core/tests/frontend/paddle/op_fuzzy.cpp @@ -0,0 +1,405 @@ +// Copyright (C) 2018-2022 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "op_fuzzy.hpp" + +#include + +#include + +#include "engines_util/test_engines.hpp" +#include "ngraph/ngraph.hpp" +#include "paddle_utils.hpp" +#include "util/test_control.hpp" + +using namespace ngraph; +using namespace InferenceEngine; +using namespace ngraph; +using namespace ov::frontend; + +using PaddleFuzzyOpTest = FrontEndFuzzyOpTest; + +static const std::vector models{ + std::string("argmax"), + std::string("argmax1"), + std::string("assign_none/assign_none.pdmodel"), + std::string("assign_output/assign_output.pdmodel"), + std::string("assign_value_boolean"), + std::string("assign_value_fp32"), + std::string("assign_value_int32"), + std::string("assign_value_int64"), + std::string("avgAdaptivePool2D_test1"), + std::string("avgPool_test1"), + std::string("avgPool_test10"), + std::string("avgPool_test11"), + std::string("avgPool_test2"), + std::string("avgPool_test3"), + std::string("avgPool_test4"), + std::string("avgPool_test5"), + // avgPool_test6, + std::string("avgPool_test7"), + std::string("avgPool_test8"), + std::string("avgPool_test9"), + std::string("batch_norm_nchw"), + std::string("batch_norm_nhwc"), + std::string("bicubic_downsample_false_0"), + std::string("bicubic_downsample_false_1"), + std::string("bicubic_downsample_true_0"), + std::string("bicubic_upsample_false_0"), + std::string("bicubic_upsample_false_1"), + std::string("bicubic_upsample_scales"), + std::string("bicubic_upsample_scales2"), + std::string("bicubic_upsample_true_0"), + std::string("bilinear_downsample_false_0"), + std::string("bilinear_downsample_false_1"), + std::string("bilinear_downsample_true_0"), + std::string("bilinear_upsample_false_0"), + std::string("bilinear_upsample_false_1"), + std::string("bilinear_upsample_scales"), + std::string("bilinear_upsample_scales2"), + std::string("bilinear_upsample_true_0"), + std::string("bmm"), + std::string("clip"), + std::string("conv2d_dilation_assymetric_pads_strides"), + std::string("conv2d_SAME_padding"), + std::string("conv2d_strides_assymetric_padding"), + std::string("conv2d_strides_no_padding"), + std::string("conv2d_strides_padding"), + std::string("conv2d_transpose_dilation_assymetric_pads_strides"), + // conv2d_transpose_SAME_padding(Paddle outputs wrong results), + std::string("conv2d_transpose_strides_assymetric_padding"), + std::string("conv2d_transpose_strides_no_padding"), + std::string("conv2d_transpose_strides_padding"), + std::string("conv2d_transpose_VALID_padding"), + std::string("conv2d_VALID_padding"), + std::string("cumsum"), + std::string("cumsum_i32"), + std::string("cumsum_i64"), + std::string("cumsum_f32"), + std::string("cumsum_f64"), + std::string("depthwise_conv2d_convolution"), + std::string("depthwise_conv2d_transpose_convolution"), + std::string("dropout"), + std::string("dropout_upscale_in_train"), + std::string("elementwise_add1"), + std::string("elementwise_div1"), + std::string("elementwise_max1"), + std::string("elementwise_min1"), + std::string("elementwise_mul1"), + std::string("elementwise_pow1"), + std::string("elementwise_sub1"), + std::string("elementwise_add2"), + std::string("elementwise_div2"), + std::string("elementwise_max2"), + std::string("elementwise_min2"), + std::string("elementwise_mul2"), + std::string("elementwise_pow2"), + std::string("elementwise_sub2"), + std::string("elementwise_add3"), + std::string("elementwise_div3"), + std::string("elementwise_max3"), + std::string("elementwise_min3"), + std::string("elementwise_mul3"), + std::string("elementwise_pow3"), + std::string("elementwise_sub3"), + std::string("elementwise_add4"), + std::string("elementwise_div4"), + std::string("elementwise_max4"), + std::string("elementwise_min4"), + std::string("elementwise_mul4"), + std::string("elementwise_pow4"), + std::string("elementwise_sub4"), + std::string("embedding_0"), + std::string("embedding_sparse"), + std::string("embedding_none_weight"), + std::string("embedding_paddings"), + std::string("embedding_paddings_neg1"), + std::string("embedding_tensorIds"), + std::string("embedding_tensorIds_paddings"), + std::string("equal"), + std::string("expand_v2"), + std::string("expand_v2_tensor"), + std::string("expand_v2_tensor_list"), + std::string("expand_v2_tensor_list2"), + std::string("exp_test_float32"), + std::string("fill_any_like"), + std::string("fill_any_like_f16"), + std::string("fill_any_like_f32"), + std::string("fill_any_like_f64"), + std::string("fill_any_like_i32"), + std::string("fill_any_like_i64"), + std::string("fill_constant"), + std::string("fill_constant_batch_size_like"), + std::string("fill_constant_int32"), + std::string("fill_constant_int64"), + std::string("fill_constant_tensor"), + std::string("fill_constant_shape_tensor"), + std::string("fill_constant_shape_tensor_list"), + std::string("flatten_contiguous_range_test1"), + std::string("floor_float32"), + std::string("gather_multi_dimension"), + std::string("gather_one_dimension"), + std::string("gather_one_dimension2"), + // gather_axis_input + // (CVS-82724: not support Axis as input), + std::string("gelu_erf"), + std::string("gelu_tanh"), + std::string("generate_proposals_v2_0"), + std::string("generate_proposals_v2_1"), + std::string("generate_proposals_v2_2"), + std::string("generate_proposals_v2_3"), + std::string("generate_proposals_v2_4"), + std::string("generate_proposals_v2_5"), + std::string("generate_proposals_v2_6"), + // greater_equal_big_int64(failure due to CPU inference), + std::string("greater_equal_big_int64"), + std::string("greater_equal_float32"), + std::string("greater_equal_int32"), + std::string("greater_equal_int64"), + std::string("greater_than_float32"), + std::string("greater_than_int32"), + std::string("greater_than_int64"), + std::string("hard_sigmoid"), + std::string("hard_swish"), + std::string("layer_norm"), + std::string("layer_norm_noall"), + std::string("layer_norm_noscale"), + std::string("layer_norm_noshift"), + std::string("leaky_relu"), + std::string("less_than_float32"), + std::string("less_than_int32"), + std::string("less_than_int64"), + std::string("linear_downsample_false_0"), + std::string("linear_downsample_false_1"), + std::string("linear_downsample_true_0"), + std::string("linear_upsample_false_0"), + std::string("linear_upsample_false_1"), + std::string("linear_upsample_scales"), + std::string("linear_upsample_scales2"), + std::string("linear_upsample_true_0"), + std::string("log"), + std::string("logical_and"), + std::string("logical_not"), + std::string("logical_or"), + std::string("logical_xor"), + std::string("matmul_xt"), + std::string("matmul_xt_yt"), + std::string("matmul_yt"), + std::string("matmul_v2_1dx1d"), + std::string("matmul_v2_1dx2d"), + std::string("matmul_v2_2dx1d"), + std::string("matmul_v2_ndxmd"), + std::string("matmul_v2_xt"), + std::string("matmul_v2_xt_yt"), + std::string("matmul_v2_yt"), + std::string("matrix_nms_by_background"), + std::string("matrix_nms_by_keep_top_k"), + std::string("matrix_nms_by_nms_top_k"), + std::string("matrix_nms_by_post_threshold"), + std::string("matrix_nms_flipped_coordinates"), + std::string("matrix_nms_gaussian"), + std::string("matrix_nms_gaussian_sigma"), + std::string("matrix_nms_identical_boxes"), + std::string("matrix_nms_not_normalized"), + std::string("matrix_nms_not_return_indexed"), + std::string("matrix_nms_not_return_rois_num"), + std::string("matrix_nms_not_return_rois_num_neither_index"), + std::string("matrix_nms_one_batch"), + std::string("matrix_nms_single_box"), + std::string("matrix_nms_two_batches_two_classes"), + std::string("matrix_nms_normalized_random"), + std::string("matrix_nms_not_normalized_random"), + std::string("maxAdaptivePool2D_test1"), + std::string("maxPool_test1"), + std::string("maxPool_test10"), + std::string("maxPool_test11"), + std::string("maxPool_test2"), + std::string("maxPool_test3"), + std::string("maxPool_test4"), + std::string("maxPool_test5"), + // maxPool_test6(nchw support is disabled now), + std::string("maxPool_test7"), + std::string("maxPool_test8"), + std::string("maxPool_test9"), + std::string("meshgrid/meshgrid.pdmodel"), + std::string("multiclass_nms_by_background"), + std::string("multiclass_nms_by_class_id"), + std::string("multiclass_nms_by_IOU"), + std::string("multiclass_nms_by_IOU_and_scores"), + std::string("multiclass_nms_by_keep_top_k"), + std::string("multiclass_nms_by_nms_eta"), + std::string("multiclass_nms_by_nms_top_k"), + std::string("multiclass_nms_flipped_coordinates"), + std::string("multiclass_nms_identical_boxes"), + // default + std::string("multiclass_nms_lod_roisnum_multiple_images_default"), + std::string("multiclass_nms_lod_roisnum_multiple_images_0_default"), + std::string("multiclass_nms_lod_roisnum_single_image_default"), + // background + std::string("multiclass_nms_lod_roisnum_multiple_images_background"), + std::string("multiclass_nms_lod_roisnum_multiple_images_0_background"), + std::string("multiclass_nms_lod_roisnum_single_image_background"), + // score_threshold + std::string("multiclass_nms_lod_roisnum_multiple_images_score_threshold"), + std::string("multiclass_nms_lod_roisnum_multiple_images_0_score_threshold"), + std::string("multiclass_nms_lod_roisnum_single_image_score_threshold"), + // nms_top_k + std::string("multiclass_nms_lod_roisnum_multiple_images_nms_top_k"), + std::string("multiclass_nms_lod_roisnum_multiple_images_0_nms_top_k"), + std::string("multiclass_nms_lod_roisnum_single_image_nms_top_k"), + // keep_top_k + std::string("multiclass_nms_lod_roisnum_multiple_images_keep_top_k"), + std::string("multiclass_nms_lod_roisnum_multiple_images_0_keep_top_k"), + std::string("multiclass_nms_lod_roisnum_single_image_keep_top_k"), + // normalized + std::string("multiclass_nms_lod_roisnum_multiple_images_normalized"), + std::string("multiclass_nms_lod_roisnum_multiple_images_0_normalized"), + std::string("multiclass_nms_lod_roisnum_single_image_normalized"), + std::string("multiclass_nms_not_normalized"), + std::string("multiclass_nms_not_return_indexed"), + std::string("multiclass_nms_single_box"), + std::string("multiclass_nms_two_batches_two_classes_by_class_id"), + std::string("multiclass_nms_normalized_random"), + std::string("multiclass_nms_not_normalized_random"), + std::string("nearest_downsample_false_0"), + std::string("nearest_downsample_false_1"), + std::string("nearest_upsample_false_0"), + std::string("nearest_upsample_false_1"), + std::string("pad3d_test1"), + std::string("pad3d_test2"), + std::string("pad3d_test3"), + // pad3d_test4, + std::string("pow_float32"), + std::string("pow_int32"), + std::string("pow_int64"), + // pow_int64_out_of_range(out of range of OV int64), + std::string("pow_y_tensor"), + std::string("prior_box_attrs_mmar_order_true"), + std::string("prior_box_default"), + std::string("prior_box_flip_clip_false"), + std::string("prior_box_max_sizes_none"), + std::string("range0"), + std::string("range1"), + std::string("range2"), + std::string("reduce_max_test_0"), + std::string("reduce_max_test_1"), + std::string("reduce_max_test_2"), + std::string("reduce_max_test_3"), + std::string("reduce_max_test_4"), + std::string("reduce_max_test_5"), + std::string("reduce_mean_test_0"), + std::string("reduce_mean_test_1"), + std::string("reduce_mean_test_2"), + std::string("reduce_mean_test_3"), + std::string("reduce_mean_test_4"), + std::string("reduce_mean_test_5"), + std::string("reduce_min_test_0"), + std::string("reduce_min_test_1"), + std::string("reduce_min_test_2"), + std::string("reduce_min_test_3"), + std::string("reduce_min_test_4"), + std::string("reduce_min_test_5"), + std::string("reduce_prod_test_0"), + std::string("reduce_prod_test_1"), + std::string("reduce_prod_test_2"), + std::string("reduce_prod_test_3"), + std::string("reduce_prod_test_4"), + std::string("reduce_prod_test_5"), + std::string("reduce_sum_test_0"), + std::string("reduce_sum_test_1"), + std::string("reduce_sum_test_2"), + std::string("reduce_sum_test_3"), + std::string("reduce_sum_test_4"), + std::string("reduce_sum_test_5"), + std::string("relu"), + std::string("relu6"), + std::string("relu6_1"), + std::string("reshape"), + std::string("reshape_tensor"), + std::string("reshape_tensor_list"), + std::string("rnn_lstm_layer_1_bidirectional"), + std::string("rnn_lstm_layer_1_forward"), + std::string("rnn_lstm_layer_2_bidirectional"), + std::string("rnn_lstm_layer_2_forward"), + std::string("rnn_lstm_layer_1_forward_seq_len_4"), + std::string("rnn_lstm_layer_2_bidirectional_seq_len_4"), + std::string("roi_align_test"), + std::string("roi_align_test2"), + std::string("scale_bias_after_float32"), + std::string("scale_bias_after_int32"), + std::string("scale_bias_after_int64"), + std::string("scale_bias_before_float32"), + std::string("scale_bias_before_int32"), + std::string("scale_bias_before_int64"), + std::string("scale_tensor_bias_after"), + std::string("scale_tensor_bias_before"), + std::string("shape"), + std::string("sigmoid"), + std::string("slice"), + std::string("slice_1d"), + std::string("slice_decrease_axis/slice_decrease_axis.pdmodel"), + std::string("slice_decrease_axis_all/slice_decrease_axis_all.pdmodel"), + std::string("slice_reshape/slice_reshape.pdmodel"), + std::string("softmax"), + std::string("softmax_minus"), + std::string("softplus_default_params"), + std::string("split_test1"), + std::string("split_test2"), + std::string("split_test3"), + std::string("split_test4"), + std::string("split_test5"), + std::string("split_test6"), + std::string("split_test_dim_int32"), + std::string("split_test_dim_int64"), + std::string("split_test_list"), + std::string("split_test_list_tensor"), + std::string("sqrt_float32"), + std::string("squeeze"), + std::string("squeeze_null_axes"), + std::string("stack_test_float32"), + std::string("stack_test_int32"), + std::string("stack_test_neg_axis"), + std::string("stack_test_none_axis"), + std::string("strided_slice_input1_1"), + std::string("strided_slice_input1_2"), + std::string("strided_slice_input1_3"), + std::string("strided_slice_input1_4"), + std::string("strided_slice_input2_1"), + std::string("strided_slice_input2_2"), + std::string("strided_slice_input2_3"), + std::string("strided_slice_input3_1"), + std::string("strided_slice_input3_2"), + std::string("swish_default_params"), + std::string("swish_beta"), + std::string("tanh"), + std::string("top_k_v2_test_1"), + std::string("top_k_v2_test_2"), + std::string("top_k_v2_test_3"), + std::string("top_k_v2_test_4"), + std::string("top_k_v2_test_5"), + std::string("trilinear_downsample_false_0"), + std::string("trilinear_downsample_false_1"), + std::string("trilinear_downsample_true_0"), + std::string("trilinear_upsample_false_0"), + std::string("trilinear_upsample_false_1"), + std::string("trilinear_upsample_scales"), + std::string("trilinear_upsample_scales2"), + std::string("trilinear_upsample_true_0"), + std::string("unsqueeze"), + std::string("where_1"), + std::string("where_2"), + std::string("where_3"), + // Temporily disable them until root caused to secure CI stable. + // CVS-66703 to track this. + // std::string("yolo_box_clip_box"), + // std::string("yolo_box_default"), + // std::string("yolo_box_scale_xy"), + std::string("yolo_box_uneven_wh")}; + +INSTANTIATE_TEST_SUITE_P(PaddleFuzzyOpTest, + FrontEndFuzzyOpTest, + ::testing::Combine(::testing::Values(PADDLE_FE), + ::testing::Values(std::string(TEST_PADDLE_MODELS_DIRNAME)), + ::testing::ValuesIn(models)), + PaddleFuzzyOpTest::getTestCaseName); From 11eab76e1e5e82fdcd361c7ff67da746aa22f418 Mon Sep 17 00:00:00 2001 From: meiyang-intel Date: Tue, 7 Jun 2022 23:59:02 -0400 Subject: [PATCH 3/7] fix variable support issue for paddle top_k_v2 --- src/core/tests/frontend/paddle/op_fuzzy.cpp | 1 + .../test_models/gen_scripts/generate_top_k_v2.py | 16 +++++++++++----- src/frontends/paddle/src/op/top_k_v2.cpp | 3 ++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/core/tests/frontend/paddle/op_fuzzy.cpp b/src/core/tests/frontend/paddle/op_fuzzy.cpp index bfdbea5dd825d6..37b2fd7c802b40 100644 --- a/src/core/tests/frontend/paddle/op_fuzzy.cpp +++ b/src/core/tests/frontend/paddle/op_fuzzy.cpp @@ -378,6 +378,7 @@ static const std::vector models{ std::string("top_k_v2_test_3"), std::string("top_k_v2_test_4"), std::string("top_k_v2_test_5"), + std::string("top_k_v2_test_6"), std::string("trilinear_downsample_false_0"), std::string("trilinear_downsample_false_1"), std::string("trilinear_downsample_true_0"), diff --git a/src/core/tests/frontend/paddle/test_models/gen_scripts/generate_top_k_v2.py b/src/core/tests/frontend/paddle/test_models/gen_scripts/generate_top_k_v2.py index 28e9320f6aa052..86a28263dd4594 100644 --- a/src/core/tests/frontend/paddle/test_models/gen_scripts/generate_top_k_v2.py +++ b/src/core/tests/frontend/paddle/test_models/gen_scripts/generate_top_k_v2.py @@ -9,14 +9,17 @@ data_type = 'float32' -def top_k_v2(name: str, x, k: int, axis=None, largest=True, sorted=True): +def top_k_v2(name: str, x, k: int, axis=None, largest=True, sorted=True, k_is_var=True): paddle.enable_static() + k = np.array([k], dtype='int32') if k_is_var else k + with paddle.static.program_guard(paddle.static.Program(), paddle.static.Program()): node_x = paddle.static.data(name='x', shape=x.shape, dtype='float32') + input_k = paddle.static.data(name='k', shape=[1], dtype='int32') if k_is_var else k value, indices = paddle.topk( - node_x, k=k, axis=axis, largest=largest, sorted=sorted, name="top_k") + node_x, k=input_k, axis=axis, largest=largest, sorted=sorted, name="top_k") indices = paddle.cast(indices, np.float32) cpu = paddle.static.cpu_places(1) @@ -24,12 +27,14 @@ def top_k_v2(name: str, x, k: int, axis=None, largest=True, sorted=True): # startup program will call initializer to initialize the parameters. exe.run(paddle.static.default_startup_program()) + feed_list = {'x': x, 'k': k} if k_is_var else {'x': x} outs = exe.run( - feed={'x': x}, + feed=feed_list, fetch_list=[value, indices]) - saveModel(name, exe, feedkeys=['x'], fetchlist=[value, indices], inputs=[ - x], outputs=outs, target_dir=sys.argv[1]) + feedkey_list = ['x', 'k'] if k_is_var else ['x'] + input_list = [x, k] if k_is_var else [x] + saveModel(name, exe, feedkeys=feedkey_list, fetchlist=[value, indices], inputs=input_list, outputs=outs, target_dir=sys.argv[1]) return outs[0] @@ -43,6 +48,7 @@ def main(): top_k_v2("top_k_v2_test_4", data, k=7, axis=None, largest=True, sorted=True) top_k_v2("top_k_v2_test_5", data, k=6, axis=2, largest=False, sorted=True) + top_k_v2("top_k_v2_test_6", data, k=6, axis=2, largest=False, sorted=True, k_is_var=False) if __name__ == "__main__": diff --git a/src/frontends/paddle/src/op/top_k_v2.cpp b/src/frontends/paddle/src/op/top_k_v2.cpp index b4724026859baf..e48a4dd286d207 100644 --- a/src/frontends/paddle/src/op/top_k_v2.cpp +++ b/src/frontends/paddle/src/op/top_k_v2.cpp @@ -13,7 +13,8 @@ NamedOutputs top_k_v2(const NodeContext& node) { Output k_expected_node; if (node.has_input("K")) { auto k_variable = node.get_input("K"); - k_expected_node = std::make_shared(k_variable, element::i32); + auto k_var_node = std::make_shared(k_variable, element::i32); + k_expected_node = std::make_shared(k_var_node); } else { const auto k_expected = node.get_attribute("k", 1); k_expected_node = default_opset::Constant::create(element::i32, {}, {k_expected}); From 89b1c7567ef1cfcb3336fd93b9b5f99d6ec5608c Mon Sep 17 00:00:00 2001 From: OpenVINO-dev-contest <91237924+OpenVINO-dev-contest@users.noreply.github.com> Date: Mon, 13 Jun 2022 23:11:43 +0800 Subject: [PATCH 4/7] Update src/frontends/paddle/src/op/top_k_v2.cpp Co-authored-by: Bo Liu --- src/frontends/paddle/src/op/top_k_v2.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/frontends/paddle/src/op/top_k_v2.cpp b/src/frontends/paddle/src/op/top_k_v2.cpp index e48a4dd286d207..38af05554217fe 100644 --- a/src/frontends/paddle/src/op/top_k_v2.cpp +++ b/src/frontends/paddle/src/op/top_k_v2.cpp @@ -20,9 +20,9 @@ NamedOutputs top_k_v2(const NodeContext& node) { k_expected_node = default_opset::Constant::create(element::i32, {}, {k_expected}); } - auto axis = node.get_attribute("axis"); - bool sorted = node.get_attribute("sorted"); - bool largest = node.get_attribute("largest"); + auto axis = node.get_attribute("axis", -1); + bool sorted = node.get_attribute("sorted", true); + bool largest = node.get_attribute("largest", true); const element::Type& index_element_type = element::i32; std::string sort_type = sorted ? "value" : "none"; From 57d5124b8c55524032f38a98d4f9a3ec1401eb20 Mon Sep 17 00:00:00 2001 From: OpenVINO-dev-contest <91237924+OpenVINO-dev-contest@users.noreply.github.com> Date: Mon, 13 Jun 2022 23:13:34 +0800 Subject: [PATCH 5/7] Update src/frontends/paddle/src/op/top_k_v2.cpp Co-authored-by: Bo Liu --- src/frontends/paddle/src/op/top_k_v2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontends/paddle/src/op/top_k_v2.cpp b/src/frontends/paddle/src/op/top_k_v2.cpp index 38af05554217fe..6273219f5412df 100644 --- a/src/frontends/paddle/src/op/top_k_v2.cpp +++ b/src/frontends/paddle/src/op/top_k_v2.cpp @@ -29,7 +29,7 @@ NamedOutputs top_k_v2(const NodeContext& node) { std::string mode = largest ? "max" : "min"; auto node_topk = - std::make_shared(x, k_expected_node, axis, mode, sort_type, index_element_type); + std::make_shared(x, k_expected_node, axis, mode, sort_type); NamedOutputs named_outputs; named_outputs["Out"] = OutputVector{node_topk->output(0)}; From 9d1dafa9edb562b3ee1eade0886216abbc9ac23b Mon Sep 17 00:00:00 2001 From: OpenVINO-dev-contest <91237924+OpenVINO-dev-contest@users.noreply.github.com> Date: Mon, 13 Jun 2022 23:14:55 +0800 Subject: [PATCH 6/7] Update src/frontends/paddle/src/op/top_k_v2.cpp Co-authored-by: Bo Liu --- src/frontends/paddle/src/op/top_k_v2.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/frontends/paddle/src/op/top_k_v2.cpp b/src/frontends/paddle/src/op/top_k_v2.cpp index 6273219f5412df..ae34bc50cc79c5 100644 --- a/src/frontends/paddle/src/op/top_k_v2.cpp +++ b/src/frontends/paddle/src/op/top_k_v2.cpp @@ -23,7 +23,6 @@ NamedOutputs top_k_v2(const NodeContext& node) { auto axis = node.get_attribute("axis", -1); bool sorted = node.get_attribute("sorted", true); bool largest = node.get_attribute("largest", true); - const element::Type& index_element_type = element::i32; std::string sort_type = sorted ? "value" : "none"; std::string mode = largest ? "max" : "min"; From de1de6fcf4076a2041fc648b2224155313b64e76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9COpenvino-dev-contest=E2=80=9D?= Date: Tue, 14 Jun 2022 09:38:27 +0800 Subject: [PATCH 7/7] format the top_k_v2.cpp --- .../paddle/test_models/gen_scripts/generate_top_k_v2.py | 1 - src/frontends/paddle/src/op/top_k_v2.cpp | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/core/tests/frontend/paddle/test_models/gen_scripts/generate_top_k_v2.py b/src/core/tests/frontend/paddle/test_models/gen_scripts/generate_top_k_v2.py index 86a28263dd4594..92126e885b0ce8 100644 --- a/src/core/tests/frontend/paddle/test_models/gen_scripts/generate_top_k_v2.py +++ b/src/core/tests/frontend/paddle/test_models/gen_scripts/generate_top_k_v2.py @@ -41,7 +41,6 @@ def top_k_v2(name: str, x, k: int, axis=None, largest=True, sorted=True, k_is_va def main(): data = np.random.random([8, 9, 10]).astype("float32") - # sorted must be true top_k_v2("top_k_v2_test_1", data, k=5, axis=-2, largest=True, sorted=True) top_k_v2("top_k_v2_test_2", data, k=6, axis=-1, largest=True, sorted=True) top_k_v2("top_k_v2_test_3", data, k=4, axis=0, largest=False, sorted=True) diff --git a/src/frontends/paddle/src/op/top_k_v2.cpp b/src/frontends/paddle/src/op/top_k_v2.cpp index ae34bc50cc79c5..ba9bfff9b1513f 100644 --- a/src/frontends/paddle/src/op/top_k_v2.cpp +++ b/src/frontends/paddle/src/op/top_k_v2.cpp @@ -27,8 +27,7 @@ NamedOutputs top_k_v2(const NodeContext& node) { std::string sort_type = sorted ? "value" : "none"; std::string mode = largest ? "max" : "min"; - auto node_topk = - std::make_shared(x, k_expected_node, axis, mode, sort_type); + auto node_topk = std::make_shared(x, k_expected_node, axis, mode, sort_type); NamedOutputs named_outputs; named_outputs["Out"] = OutputVector{node_topk->output(0)};