[PT FE] Simplify repeat operation (#19926)
This commit is contained in:
1 parent
ca344aea54
commit
f926e0e392
2 files changed
+1
-36
No files matched your search
@@ -1,34 +0,0 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "openvino/frontend/pytorch/node_context.hpp"
|
||||
#include "openvino/op/broadcast.hpp"
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "openvino/op/shape_of.hpp"
|
||||
#include "openvino/op/tile.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace frontend {
|
||||
namespace pytorch {
|
||||
namespace op {
|
||||
|
||||
using namespace ov::op;
|
||||
|
||||
OutputVector translate_repeat(const NodeContext& context) {
|
||||
num_inputs_check(context, 2, 2);
|
||||
auto x = context.get_input(0);
|
||||
auto repeats = context.get_input(1);
|
||||
auto one = context.mark_node(v0::Constant::create(element::i32, Shape{}, {1}));
|
||||
auto sizes_shape = context.mark_node(std::make_shared<v3::ShapeOf>(repeats, element::i32));
|
||||
auto expand_shape = context.mark_node(std::make_shared<v3::Broadcast>(one, sizes_shape));
|
||||
auto expanded_input =
|
||||
context.mark_node(std::make_shared<v3::Broadcast>(x, expand_shape, BroadcastType::BIDIRECTIONAL));
|
||||
return {context.mark_node(std::make_shared<v0::Tile>(expanded_input, repeats))};
|
||||
};
|
||||
|
||||
} // namespace op
|
||||
} // namespace pytorch
|
||||
} // namespace frontend
|
||||
} // namespace ov
|
||||
@@ -134,7 +134,6 @@ OP_CONVERTER(translate_randn_like);
|
||||
OP_CONVERTER(translate_reciprocal);
|
||||
OP_CONVERTER(translate_relu6);
|
||||
OP_CONVERTER(translate_remainder);
|
||||
OP_CONVERTER(translate_repeat);
|
||||
OP_CONVERTER(translate_repeat_interleave);
|
||||
OP_CONVERTER(translate_reshape);
|
||||
OP_CONVERTER(translate_reshape_as);
|
||||
@@ -393,7 +392,7 @@ const std::map<std::string, CreatorFunction> get_supported_ops_ts() {
|
||||
{"aten::relu_", op::inplace_op<op::translate_1to1_match_1_inputs<opset10::Relu>>},
|
||||
{"aten::relu6", op::translate_relu6},
|
||||
{"aten::remainder", op::translate_remainder},
|
||||
{"aten::repeat", op::translate_repeat},
|
||||
{"aten::repeat", op::inplace_op<op::translate_1to1_match_2_inputs<opset10::Tile>>},
|
||||
{"aten::repeat_interleave", op::translate_repeat_interleave},
|
||||
{"aten::reshape", op::translate_reshape},
|
||||
{"aten::reshape_as", op::translate_reshape_as},
|
||||
|
||||
Reference in new issue
Block a user