From 779ee1d1f3ece955c8e8dca8cb360e620728de3a Mon Sep 17 00:00:00 2001 From: Sergey Lyalin Date: Tue, 4 Oct 2022 14:11:11 +0200 Subject: [PATCH] Added WA for TupleConstruct with a single input (used in torch.fx fragments as the last operation). Should be implemented differently. --- src/frontends/pytorch/src/op_table.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/frontends/pytorch/src/op_table.cpp b/src/frontends/pytorch/src/op_table.cpp index 6840a2136ec927..1c08a6cdef05f2 100644 --- a/src/frontends/pytorch/src/op_table.cpp +++ b/src/frontends/pytorch/src/op_table.cpp @@ -645,6 +645,16 @@ const std::map get_supported_ops() { return {context.mark_node(std::make_shared(x, cast))}; }}, + {"prim::TupleConstruct", + [](NodeContext& context) -> OutputVector { + auto n_inputs = context.get_input_size(); + if(n_inputs == 1) { + return {context.get_input(0)}; + } else { + throw std::runtime_error("prim::TupleConstruct conversion doesn't support cases when the number of inputs is not one."); + } + }}, + /* TODO: Don't need a special way to handle prim::ListConstruct as it doesn't provide any extra service extra to FW Node at this moment { "prim::ListConstruct", [](NodeContext& context) -> OutputVector { // TODO. Probably need to replace by a constant of size 0 in one of the following transformations that embed Lists to Tensors for OV.