diff --git a/src/bindings/python/src/openvino/frontend/pytorch/ts_decoder.py b/src/bindings/python/src/openvino/frontend/pytorch/ts_decoder.py index ce8c60c864dbaf..e07a23dc5cccc1 100644 --- a/src/bindings/python/src/openvino/frontend/pytorch/ts_decoder.py +++ b/src/bindings/python/src/openvino/frontend/pytorch/ts_decoder.py @@ -58,8 +58,15 @@ def __init__(self, pt_module, graph_element=None, example_input=None, alias_db=N self.pt_module = pt_module self.raw_inputs = list(self.graph_element.inputs()) self.raw_outputs = list(self.graph_element.outputs()) - if self._input_signature is not None and "self" in self.raw_inputs[0].debugName(): - self._input_signature.insert(0, "self") + if self._input_signature is not None: + if "self" in self.raw_inputs[0].debugName(): + self._input_signature.insert(0, "self") + if 0 < len(self._input_signature) < len(self.raw_inputs): + # last input is args input, we need to multiply that name by number of extra inputs + self._input_signature = self._input_signature[:-1] + n = len(self._input_signature) + for i in range(len(self.raw_inputs) - n): + self._input_signature.append(self.raw_inputs[i + n].debugName()) if isinstance(self.graph_element, torch.Graph): self._transform_tensor_list_constants_to_listconstruct(self.graph_element) diff --git a/src/frontends/pytorch/src/utils_quantize.cpp b/src/frontends/pytorch/src/utils_quantize.cpp index a8820b8ffe473d..aee7d74eca9c51 100644 --- a/src/frontends/pytorch/src/utils_quantize.cpp +++ b/src/frontends/pytorch/src/utils_quantize.cpp @@ -156,8 +156,8 @@ Output quantize(const NodeContext& context, FRONT_END_OP_CONVERSION_CHECK(false, "Failed to convert a node to QuantizedPtNode"); } -std::shared_ptr cast_quantized_fw_node(Output node) { - auto quant_node = std::dynamic_pointer_cast(node.get_node_shared_ptr()); +std::shared_ptr cast_quantized_fw_node(std::shared_ptr node) { + auto quant_node = std::dynamic_pointer_cast(node); if (!quant_node) { return nullptr; } @@ -168,19 +168,6 @@ std::shared_ptr cast_quantized_fw_node(Output node) { return quant_node; } -std::shared_ptr cast_quantized_fw_node(Output node, const std::string& type) { - auto quant_node = std::dynamic_pointer_cast(node.get_node_shared_ptr()); - if (!quant_node) { - return nullptr; - } - const auto& attrs = quant_node->get_attrs(); - if (attrs.find(QuantizedPtNode::quantized_node_type_key) == attrs.end() || - attrs.at(QuantizedPtNode::quantized_node_type_key) != type) { - return nullptr; - } - return quant_node; -} - } // namespace pytorch } // namespace frontend } // namespace ov diff --git a/src/frontends/pytorch/src/utils_quantize.hpp b/src/frontends/pytorch/src/utils_quantize.hpp index a78855ca2b3eb5..0d5219f00885f7 100644 --- a/src/frontends/pytorch/src/utils_quantize.hpp +++ b/src/frontends/pytorch/src/utils_quantize.hpp @@ -140,8 +140,7 @@ Output quantize(const NodeContext& context, const Output& zero_point, const Output& quantized_node); -std::shared_ptr cast_quantized_fw_node(Output node); -std::shared_ptr cast_quantized_fw_node(Output node, const std::string& type); +std::shared_ptr cast_quantized_fw_node(std::shared_ptr node); namespace op { /**