Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

Fix typos in frontends and few obvious issues in onnx and pytorch (#33853)

Maxim Vafin9cd848a218a8
diff --git a/src/frontends/common/include/openvino/frontend/exception.hpp b/src/frontends/common/include/openvino/frontend/exception.hpp
index 8ac6af1b9c9..62fc11bd833 100644
--- a/src/frontends/common/include/openvino/frontend/exception.hpp
+++ b/src/frontends/common/include/openvino/frontend/exception.hpp
@@ -76,7 +76,7 @@ protected:
/// \param cond Condition to check
/// \param ... Additional error message info to be added to the error message via the `<<`
/// stream-insertion operator. Note that the expressions here will be evaluated lazily,
-/// i.e., only if the `cond` evalutes to `false`.
+/// i.e., only if the `cond` evaluates to `false`.
/// \throws ::ov::frontend::GeneralFailure if `cond` is false.
#define FRONT_END_GENERAL_CHECK(...) OPENVINO_ASSERT_HELPER(::ov::frontend::GeneralFailure, "", __VA_ARGS__)
@@ -84,7 +84,7 @@ protected:
/// \param cond Condition to check
/// \param ... Additional error message info to be added to the error message via the `<<`
/// stream-insertion operator. Note that the expressions here will be evaluated lazily,
-/// i.e., only if the `cond` evalutes to `false`.
+/// i.e., only if the `cond` evaluates to `false`.
/// \throws ::ov::frontend::InitializationFailure if `cond` is false.
#define FRONT_END_INITIALIZATION_CHECK(...) \
OPENVINO_ASSERT_HELPER(::ov::frontend::InitializationFailure, "", __VA_ARGS__)
@@ -93,7 +93,7 @@ protected:
/// \param cond Condition to check
/// \param ... Additional error message info to be added to the error message via the `<<`
/// stream-insertion operator. Note that the expressions here will be evaluated lazily,
-/// i.e., only if the `cond` evalutes to `false`.
+/// i.e., only if the `cond` evaluates to `false`.
/// \throws ::ov::frontend::OpConversionFailure if `cond` is false.
#define FRONT_END_OP_CONVERSION_CHECK(...) OPENVINO_ASSERT_HELPER(::ov::frontend::OpConversionFailure, "", __VA_ARGS__)
diff --git a/src/frontends/common/src/frontend.cpp b/src/frontends/common/src/frontend.cpp
index 20829294364..a3aadebd538 100644
--- a/src/frontends/common/src/frontend.cpp
+++ b/src/frontends/common/src/frontend.cpp
@@ -73,7 +73,7 @@ std::shared_ptr<Model> FrontEnd::decode(const InputModel::Ptr& model) const {
void FrontEnd::normalize(const std::shared_ptr<Model>& model) const {
FRONT_END_CHECK_IMPLEMENTED(m_actual, normalize);
- FRONTEND_CALL_STATEMENT("Normalizing model", m_actual->normalize(model);)
+ FRONTEND_CALL_STATEMENT("Normalizing model", m_actual->normalize(model))
}
void FrontEnd::add_extension(const std::shared_ptr<ov::Extension>& extension) {
@@ -106,7 +106,7 @@ std::string FrontEnd::get_name() const {
if (!m_actual) {
return {};
}
- FRONTEND_RETURN_STATEMENT("Getting frontend name", m_actual->get_name();)
+ FRONTEND_RETURN_STATEMENT("Getting frontend name", m_actual->get_name())
}
void FrontEnd::validate_path(const std::filesystem::path& path) const {
diff --git a/src/frontends/jax/src/utils.hpp b/src/frontends/jax/src/utils.hpp
index 35a22c3a6ed..a5281c38f66 100644
--- a/src/frontends/jax/src/utils.hpp
+++ b/src/frontends/jax/src/utils.hpp
@@ -29,7 +29,7 @@ const std::string& get_jax_prefix();
/// \param COND Condition to check
/// \param ... Additional error message info to be added to the error message via the `<<`
/// stream-insertion operator. Note that the expressions here will be evaluated lazily,
-/// i.e., only if the `cond` evalutes to `false`.
+/// i.e., only if the `cond` evaluates to `false`.
/// \throws ::ov::frontend::OpConversionFailure if `cond` is false.
#ifndef JAX_OP_CONVERSION_CHECK
# define JAX_OP_CONVERSION_CHECK(COND, ...) \
diff --git a/src/frontends/onnx/docs/check_supported_ops.py b/src/frontends/onnx/docs/check_supported_ops.py
index 90113e452f0..2681cbbaedf 100644
--- a/src/frontends/onnx/docs/check_supported_ops.py
+++ b/src/frontends/onnx/docs/check_supported_ops.py
@@ -63,7 +63,7 @@ with open(supported_ops_doc, 'rt') as src:
if line.count('|') == 6:
table_line += 1
if table_line > 2:
- row = [cell.strip() for cell in line.split('|')] # Split line by "|" delimeter and remove spaces
+ row = [cell.strip() for cell in line.split('|')] # Split line by "|" delimiter and remove spaces
domain = row[1]
if not domain in ops:
ops[domain] = {}
diff --git a/src/frontends/onnx/frontend/src/core/attribute.hpp b/src/frontends/onnx/frontend/src/core/attribute.hpp
index 53958309077..fe69b53b7d1 100644
--- a/src/frontends/onnx/frontend/src/core/attribute.hpp
+++ b/src/frontends/onnx/frontend/src/core/attribute.hpp
@@ -46,11 +46,15 @@ inline float get_value(const AttributeProto& attribute) {
template <>
inline std::vector<float> get_value(const AttributeProto& attribute) {
+#if defined(_MSC_VER)
+# pragma warning(push)
+# pragma warning(disable : 4244)
+#endif
switch (attribute.type()) {
case AttributeProto_AttributeType::AttributeProto_AttributeType_INT:
return {static_cast<float>(attribute.i())};
case AttributeProto_AttributeType::AttributeProto_AttributeType_INTS:
- return {std::begin(attribute.floats()), std::end(attribute.floats())};
+ return {std::begin(attribute.ints()), std::end(attribute.ints())};
case AttributeProto_AttributeType::AttributeProto_AttributeType_FLOAT:
return {attribute.f()};
case AttributeProto_AttributeType::AttributeProto_AttributeType_FLOATS:
@@ -58,6 +62,9 @@ inline std::vector<float> get_value(const AttributeProto& attribute) {
default:
ONNX_INVALID_ATTR(attribute.type(), "INT, INTS, FLOAT, FLOATS");
}
+#if defined(_MSC_VER)
+# pragma warning(pop)
+#endif
}
template <>
diff --git a/src/frontends/onnx/frontend/src/core/graph.hpp b/src/frontends/onnx/frontend/src/core/graph.hpp
index 9caf2f4bbbe..3a62410f934 100644
--- a/src/frontends/onnx/frontend/src/core/graph.hpp
+++ b/src/frontends/onnx/frontend/src/core/graph.hpp
@@ -97,13 +97,13 @@ private:
/// cache.
class Subgraph : public Graph {
public:
- /// \brief Subgraph a GraphCache class object.
+ /// \brief Subgraph holds a GraphCache class object.
///
/// \param[in] model The ONNX model object.
/// \param[in] parent_graph The reference to the parent graph.
Subgraph(const std::shared_ptr<ModelProto>& model, Graph* parent_graph);
- /// \brief Return nodes which are on the edge the subgraph and the parent graph.
+ /// \brief Return nodes which are on the edge of the subgraph and the parent graph.
/// \return Vector of edge nodes from parent scope.
const std::vector<ov::Output<ov::Node>> get_inputs_from_parent() const;
diff --git a/src/frontends/onnx/frontend/src/core/graph_cache.hpp b/src/frontends/onnx/frontend/src/core/graph_cache.hpp
index 6290eab3da9..e39a32d23df 100644
--- a/src/frontends/onnx/frontend/src/core/graph_cache.hpp
+++ b/src/frontends/onnx/frontend/src/core/graph_cache.hpp
@@ -20,29 +20,29 @@ public:
///
/// \note GraphCache takes ownership of the node.
///
- /// \param[in] name The name of node added to the cache.
+ /// \param[in] name The name of the node added to the cache.
/// \param[in] node The node added to the cache.
void emplace_node(const std::string& name, ov::Output<ov::Node>&& node);
/// \brief Remove node from the cache
///
- /// \param[in] name The name of node to be removed
+ /// \param[in] name The name of the node to be removed
void remove_node(const std::string& name);
/// \brief Get the node from the cache
///
- /// \note If the node is not found the ov::Exception is thrown.
+ /// \note If the node is not found, an ov::Exception is thrown.
///
/// \param[in] name The name of the node.
///
/// \return The node named `name`.
virtual ov::Output<ov::Node> get_node(const std::string& name) const;
- /// \brief Return true if the node named `name` exist in the cache.
+ /// \brief Return true if the node named `name` exists in the cache.
///
/// \param[in] name The name of the node.
///
- /// \return true if the node named `name` exist in the cache, false otherwise.
+ /// \return true if the node named `name` exists in the cache, false otherwise.
virtual bool contains(const std::string& name) const;
virtual ~GraphCache() = default;
diff --git a/src/frontends/onnx/frontend/src/core/graph_iterator_proto.hpp b/src/frontends/onnx/frontend/src/core/graph_iterator_proto.hpp
index 1d07518a29a..3cea90ad630 100644
--- a/src/frontends/onnx/frontend/src/core/graph_iterator_proto.hpp
+++ b/src/frontends/onnx/frontend/src/core/graph_iterator_proto.hpp
@@ -54,7 +54,7 @@ class GraphIteratorProto : public ov::frontend::onnx::GraphIterator {
GraphIteratorProtoMemoryManagementMode m_mode;
// This is used for keeping MMAP cache handles
MappedMemoryHandles m_mmap_cache;
- // This is used for keeping a readed external data without MMAP
+ // This is used for keeping external data read without MMAP
LocalStreamHandles m_stream_cache;
LocalMemoryHandles m_data_holder;
diff --git a/src/frontends/onnx/frontend/src/detail/subgraph_extraction.hpp b/src/frontends/onnx/frontend/src/detail/subgraph_extraction.hpp
index 17d7866232f..c914f56a035 100644
--- a/src/frontends/onnx/frontend/src/detail/subgraph_extraction.hpp
+++ b/src/frontends/onnx/frontend/src/detail/subgraph_extraction.hpp
@@ -30,7 +30,7 @@ struct SubgraphExtractor {
/// \brief Adds new inputs to the graph and connects them to the nodes indicated by
/// the provided input edges.
- /// \param merge_inputs Flag indicating wheteher new inputs are generated for each input edge (false)
+ /// \param merge_inputs Flag indicating whether new inputs are generated for each input edge (false)
/// or there is only one input created for provided edges (true)
void add_new_inputs(const std::vector<InputEdge>& new_inputs, const bool merge_inputs = false);
diff --git a/src/frontends/onnx/frontend/src/edge_mapper.hpp b/src/frontends/onnx/frontend/src/edge_mapper.hpp
index 30bd26df4f9..b91eec34b57 100644
--- a/src/frontends/onnx/frontend/src/edge_mapper.hpp
+++ b/src/frontends/onnx/frontend/src/edge_mapper.hpp
@@ -29,7 +29,7 @@ public:
/// \brief Creates an edge mapper based on a GraphProto object.
///
- /// \note If state of graph_proto will be changed, the information from edge mapper
+ /// \note If the state of graph_proto changes, the information from the edge mapper
/// is outdated. In such a case the update method should be called.
///
/// \param graph_proto Reference to a GraphProto object.
@@ -39,37 +39,37 @@ public:
/// and an input (input name or input index).
///
/// \note The node name can be ambiguous (many ONNX nodes can have the same name).
- /// In such a case the algorthim tries to match the given node name
+ /// In such a case the algorithm tries to match the given node name
/// with the input name (providing an input index is not enough).
/// If a unique edge is found, it will be returned.
/// If InputEdge cannot be determined based on parameter values an
- /// ov:Exception will be thrown.
+ /// ov::Exception will be thrown.
///
/// \param node An EditorNode helper structure created based on a node name
/// or a node output name.
///
- /// \param input An EditorInput helper structure created based on a input name
- /// or a input index.
+ /// \param input An EditorInput helper structure created based on an input name
+ /// or an input index.
InputEdge find_input_edge(const EditorNode& node, const EditorInput& input) const;
/// \brief Returns an OutputEdge based on a node (node name or output name)
/// and an output (output name or output index).
///
/// \note The node name can be ambiguous (many ONNX nodes can have the same name).
- /// In such a case the algorthim will try to match the given node name
+ /// In such a case the algorithm will try to match the given node name
/// with the output name (providing an output index is not enough).
- /// If after such operation a found edge is unique, it is returned.
+ /// If the found edge is unique after such an operation, it is returned.
/// If OutputEdge cannot be determined based on given params an
/// ov::Exception is thrown.
///
/// \param node An EditorNode helper structure created based on a node name
/// or a node output name.
///
- /// \param output An EditorOutput helper structure created based on a output name
- /// or a output index.
+ /// \param output An EditorOutput helper structure created based on an output name
+ /// or an output index.
OutputEdge find_output_edge(const EditorNode& node, const EditorOutput& output) const;
- /// \brief Returns an OutputEdge based on a output name.
+ /// \brief Returns an OutputEdge based on an output name.
///
/// \note The output name guarantees the uniqueness of the edge.
///
diff --git a/src/frontends/onnx/frontend/src/editor.cpp b/src/frontends/onnx/frontend/src/editor.cpp
index f37fc1bd1c5..627b4c64575 100644
--- a/src/frontends/onnx/frontend/src/editor.cpp
+++ b/src/frontends/onnx/frontend/src/editor.cpp
@@ -229,11 +229,17 @@ void graph_topological_sort(GraphProto* graph) {
return nullptr;
};
for (const auto& output : graph->output()) {
- nodes_to_process.push(get_node_by_out_name(output.name()));
+ if (const auto* node = get_node_by_out_name(output.name())) {
+ nodes_to_process.push(node);
+ }
}
while (nodes_to_process.size() > 0) {
auto* node = nodes_to_process.top();
+ if (node == nullptr) {
+ nodes_to_process.pop();
+ continue;
+ }
bool can_add = true;
for (const auto& in_name : node->input()) {
if (in_name.empty()) {
diff --git a/src/frontends/onnx/frontend/src/editor.hpp b/src/frontends/onnx/frontend/src/editor.hpp
index f71a1138b51..eccc2cb6cb4 100644
--- a/src/frontends/onnx/frontend/src/editor.hpp
+++ b/src/frontends/onnx/frontend/src/editor.hpp
@@ -59,7 +59,7 @@ public:
/// \brief Creates an editor from a ModelProto. The model_proto is
/// stored in m_model_proto member variable.
///
- /// \param model_proto A shared pointer on ModelProto object.
+ /// \param model_proto A shared pointer to a ModelProto object.
/// \param extensions Holder for custom extensions (like custom ops).
ONNXModelEditor(std::shared_ptr<ModelProto> model_proto, frontend::ExtensionHolder extensions = {});
@@ -67,7 +67,7 @@ public:
/// custom input types for all inputs specified in the provided map.
///
/// \param input_types A collection of pairs {input_name: new_input_type} that should be
- /// used to modified the ONNX model loaded from a file. This method
+ /// used to modify the ONNX model loaded from a file. This method
/// throws an exception if the model doesn't contain any of
/// the inputs specified in its parameter.
void set_input_types(const std::map<std::string, ov::element::Type_t>& input_types);
@@ -76,7 +76,7 @@ public:
/// custom input shapes for all inputs specified in the provided map.
///
/// \param input_shapes A collection of pairs {input_name: new_input_shape} that should
- /// be used to modified the ONNX model loaded from a file. This
+ /// be used to modify the ONNX model loaded from a file. This
/// method throws an exception if the model doesn't contain any of
/// the inputs specified in its parameter.
void set_input_shapes(const std::map<std::string, ov::PartialShape>& input_shapes);
@@ -98,7 +98,7 @@ public:
/// \param inputs A collection of input edges which become new inputs to the graph
/// \param outputs A collection of output edges which become new outputs of the graph
/// \param merge_inputs Flag indicates whether newly created inputs after cutting shall be independent or merged,
- /// false - each cutted edge will be connected with one new input (default),
+ /// false - each cut edge will be connected with one new input (default),
/// true - all input edges will be connected to one new input
void extract_subgraph(const std::vector<InputEdge>& inputs,
const std::vector<OutputEdge>& outputs,
@@ -168,7 +168,7 @@ public:
/// instance of the model editor, in particular the subgraph extraction which
/// can discard some inputs from the original graph.
///
- /// \note ONNX initializers is not treated as input of the model.
+ /// \note ONNX initializers are not treated as inputs of the model.
std::vector<std::string> model_inputs() const;
/// \brief Returns a list of all outputs of the in-memory model.
@@ -207,7 +207,7 @@ public:
/// and an input (input name or input index).
///
/// \note The node name can be ambiguous (many ONNX nodes can have the same name).
- /// In such a case the algorthim tries to match the given node name
+ /// In such a case the algorithm tries to match the given node name
/// with the input name (providing an input index is not enough).
/// If a unique edge is found, it will be returned.
/// If InputEdge cannot be determined based on parameter values an ov::Exception
@@ -216,15 +216,15 @@ public:
/// \param node A node helper structure created based on a node name
/// or a node output name.
///
- /// \param input An input helper structure created based on a input name
- /// or a input index.
+ /// \param input An input helper structure created based on an input name
+ /// or an input index.
InputEdge find_input_edge(const EditorNode& node, const EditorInput& input) const;
/// \brief Returns an OutputEdge based on a node (node name or output name)
/// and an output (output name or output index).
///
/// \note The node name can be ambiguous (many ONNX nodes can have the same name).
- /// In such a case the algorthim will try to match the given node name
+ /// In such a case the algorithm will try to match the given node name
/// with the output name (providing an output index is not enough).
/// If after such operation a found edge is unique, it is returned.
/// If OutputEdge cannot be determined based on given params the ov::Exception
@@ -233,11 +233,11 @@ public:
/// \param node A node helper structure created based on a node name
/// or a node output name.
///
- /// \param output A output helper structure created based on a output name
- /// or a output index.
+ /// \param output An output helper structure created based on an output name
+ /// or an output index.
OutputEdge find_output_edge(const EditorNode& node, const EditorOutput& output) const;
- /// \brief Returns an OutputEdge based on a output name.
+ /// \brief Returns an OutputEdge based on an output name.
///
/// \note The output name guarantees the uniqueness of the edge.
///
@@ -293,7 +293,7 @@ public:
///
std::vector<std::string> get_output_ports(const EditorNode& node) const;
- /// \brief Returns a OpenVINO Model based on edited model
+ /// \brief Returns an OpenVINO Model based on the edited model
/// decoded to framework nodes
///
std::shared_ptr<Model> decode();
@@ -306,7 +306,7 @@ public:
/// \brief Provides element type for given input tensor name.
///
- /// \param output_edge Name of tensor for which element type will be returned.
+ /// \param tensor_name Name of tensor for which element type will be returned.
///
ov::element::Type_t get_input_type(const std::string& tensor_name) const;
diff --git a/src/frontends/onnx/frontend/src/editor_types.hpp b/src/frontends/onnx/frontend/src/editor_types.hpp
index e3f80ff1286..17c5898cf63 100644
--- a/src/frontends/onnx/frontend/src/editor_types.hpp
+++ b/src/frontends/onnx/frontend/src/editor_types.hpp
@@ -105,7 +105,7 @@ struct EditorOutput {
const int m_output_index = -1;
};
-/// \brief Specifies a single node by output name which is determinitic
+/// \brief Specifies a single node by output name which is deterministic
/// or node name which can be ambiguous.
/// For a node test_node, with 2 outputs:
///
@@ -115,7 +115,7 @@ struct EditorOutput {
/// You can indicate test_node by name as EditorNode("test_node")
/// or by assigned output as EditorNode(EditorOutput("out1"))
/// or EditorNode(EditorOutput("out2"))
-/// or you can determine the node by postition of a node in an ONNX graph (in topological order).
+/// or you can determine the node by position of a node in an ONNX graph (in topological order).
struct EditorNode {
EditorNode(std::string node_name) : m_node_name{std::move(node_name)} {}
EditorNode(EditorOutput output) : m_output_name{std::move(output.m_output_name)} {}
diff --git a/src/frontends/onnx/frontend/src/input_model.cpp b/src/frontends/onnx/frontend/src/input_model.cpp
index 6514fca5f14..78b220d7803 100644
--- a/src/frontends/onnx/frontend/src/input_model.cpp
+++ b/src/frontends/onnx/frontend/src/input_model.cpp
@@ -649,7 +649,7 @@ private:
// This is used for keeping MMAP cache handles
detail::MappedMemoryHandles m_mmap_cache;
- // This is used for keeping a readed external data without MMAP
+ // This is used for keeping external data read without MMAP
detail::LocalStreamHandles m_stream_cache;
std::filesystem::path m_model_dir;
diff --git a/src/frontends/onnx/frontend/src/op/argmin.cpp b/src/frontends/onnx/frontend/src/op/argmin.cpp
index 40b4cabe6ff..c831d0db03f 100644
--- a/src/frontends/onnx/frontend/src/op/argmin.cpp
+++ b/src/frontends/onnx/frontend/src/op/argmin.cpp
@@ -15,7 +15,7 @@ ov::OutputVector argmin(const ov::frontend::onnx::Node& node) {
return {arg_factory.make_arg_min()};
}
-ONNX_OP("ArgMin", {1, 11}, ai_onnx::opset_1::argmin);
+ONNX_OP("ArgMin", OPSET_RANGE(1, 11), ai_onnx::opset_1::argmin);
} // namespace opset_1
namespace opset_12 {
diff --git a/src/frontends/onnx/frontend/src/op/com.microsoft/fused_conv.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/fused_conv.cpp
index 7981acfada5..58073d0f985 100644
--- a/src/frontends/onnx/frontend/src/op/com.microsoft/fused_conv.cpp
+++ b/src/frontends/onnx/frontend/src/op/com.microsoft/fused_conv.cpp
@@ -64,13 +64,10 @@ ov::OutputVector fused_conv(const ov::frontend::onnx::Node& node) {
const auto alpha = v0::Constant::create<float>(ov::element::f32, ov::Shape{}, {activation_params[0]});
const auto beta = v0::Constant::create<float>(ov::element::f32, ov::Shape{}, {activation_params[1]});
return {std::make_shared<v0::HardSigmoid>(conv_res, alpha, beta)};
+ } else if (activation_type.empty()) {
+ return {conv_res};
}
- CHECK_VALID_NODE(node,
- !activation_type.empty(),
- "Not supported: ",
- activation_type,
- " activation function was used");
-
+ CHECK_VALID_NODE(node, false, "Not supported: ", activation_type, " activation function was used");
return {conv_res};
}
diff --git a/src/frontends/onnx/frontend/src/op/com.microsoft/fusedmatmul.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/fusedmatmul.cpp
index b54a678cd32..4be8ac14f7a 100644
--- a/src/frontends/onnx/frontend/src/op/com.microsoft/fusedmatmul.cpp
+++ b/src/frontends/onnx/frontend/src/op/com.microsoft/fusedmatmul.cpp
@@ -1,7 +1,9 @@
// Copyright (C) 2018-2026 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
-#include "cmath"
+#include <cmath>
+#include <numeric>
+
#include "core/operator_set.hpp"
#include "exceptions.hpp"
#include "openvino/frontend/exception.hpp"
diff --git a/src/frontends/onnx/frontend/src/op/com.microsoft/matmul_integer_to_float.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/matmul_integer_to_float.cpp
index 8eae7cad5f5..e18b319fe20 100644
--- a/src/frontends/onnx/frontend/src/op/com.microsoft/matmul_integer_to_float.cpp
+++ b/src/frontends/onnx/frontend/src/op/com.microsoft/matmul_integer_to_float.cpp
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//
+#include "core/null_node.hpp"
#include "core/operator_set.hpp"
#include "exceptions.hpp"
#include "openvino/op/add.hpp"
@@ -31,13 +32,13 @@ ov::OutputVector matmulintegertofloat(const ov::frontend::onnx::Node& node) {
const auto& b_scale = inputs[3];
ov::Output<ov::Node> a_zero_point =
- (inputs.size() > 4)
+ common::is_input_valid(node, 4)
? inputs[4]
: std::make_shared<ov::op::v0::Constant>(a_int.get_element_type(), ov::Shape{}, std::vector<int8_t>{0});
ov::Output<ov::Node> b_zero_point =
- (inputs.size() > 5)
+ common::is_input_valid(node, 5)
? inputs[5]
- : std::make_shared<ov::op::v0::Constant>(a_int.get_element_type(), ov::Shape{}, std::vector<int8_t>{0});
+ : std::make_shared<ov::op::v0::Constant>(b_int.get_element_type(), ov::Shape{}, std::vector<int8_t>{0});
CHECK_VALID_NODE(node,
a_int.get_element_type() == ov::element::i8 || a_int.get_element_type() == ov::element::u8,
@@ -62,21 +63,26 @@ ov::OutputVector matmulintegertofloat(const ov::frontend::onnx::Node& node) {
const auto matmul_result = std::make_shared<ov::op::v0::MatMul>(a_scaled, b_scaled);
- if (inputs.size() > 6) {
+ if (common::is_input_valid(node, 6)) {
auto& bias = inputs[6];
+ const auto bias_shape = bias.get_partial_shape();
CHECK_VALID_NODE(node,
- bias.get_partial_shape().rank().get_length() == 1,
+ bias_shape.rank().is_static() && bias_shape.rank().get_length() == 1,
"Bias tensor must be 1D. Got shape: ",
- bias.get_partial_shape());
+ bias_shape);
- const auto b_last_dim = b_int.get_partial_shape().get_shape().back();
- const auto bias_dim = bias.get_partial_shape()[0].get_length();
+ const auto b_shape = b_int.get_partial_shape();
+ CHECK_VALID_NODE(node,
+ b_shape.rank().is_static() && b_shape.rank().get_length() >= 2,
+ "Input B must have static rank >= 2 to validate bias shape, got: ",
+ b_shape);
+ const auto last_dim_idx = b_shape.rank().get_length() - 1;
CHECK_VALID_NODE(node,
- static_cast<long int>(b_int.get_partial_shape().get_shape().back()) == bias_dim,
+ bias_shape[0].compatible(b_shape[last_dim_idx]),
"Bias dimension must match the last dimension of B. Expected: ",
- b_last_dim,
+ b_shape[last_dim_idx],
", but got: ",
- bias_dim);
+ bias_shape[0]);
return {std::make_shared<ov::op::v1::Add>(matmul_result, bias)};
}
diff --git a/src/frontends/onnx/frontend/src/op/com.microsoft/matmulnbits.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/matmulnbits.cpp
index 372c0fe5aa3..a0760a04b09 100644
--- a/src/frontends/onnx/frontend/src/op/com.microsoft/matmulnbits.cpp
+++ b/src/frontends/onnx/frontend/src/op/com.microsoft/matmulnbits.cpp
@@ -2,7 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
//
-#include "cmath"
+#include <cmath>
+#include <numeric>
+
#include "core/null_node.hpp"
#include "core/operator_set.hpp"
#include "exceptions.hpp"
@@ -50,10 +52,6 @@ ov::OutputVector matmulnbits(const ov::frontend::onnx::Node& node) {
const uint64_t expected_b_size = N * n_blocks_per_col * blob_size;
const auto& b_shape = b_quantized.get_partial_shape();
- uint64_t actual_b_size = 1;
- for (const auto& d : b_shape) {
- actual_b_size *= d.get_length();
- }
CHECK_VALID_NODE(node, n_blocks_per_col > 0, "Wrong blocks count: ", n_blocks_per_col);
CHECK_VALID_NODE(node, blob_size > 0, "Wrong blob size: ", blob_size);
@@ -63,7 +61,15 @@ ov::OutputVector matmulnbits(const ov::frontend::onnx::Node& node) {
"MatMulNBits limitation: accepting only a constant as a B input");
CHECK_VALID_NODE(
node,
- b_shape.is_static() && actual_b_size == expected_b_size,
+ b_shape.is_static(),
+ "Expected input B shape is static and compatible with shape [N][n_blocks_per_col][blob_size], got: ",
+ b_shape);
+ const auto& b_shape_static = b_shape.get_shape();
+ const uint64_t actual_b_size =
+ std::accumulate(b_shape_static.begin(), b_shape_static.end(), uint64_t{1}, std::multiplies<uint64_t>{});
+ CHECK_VALID_NODE(
+ node,
+ actual_b_size == expected_b_size,
"Expected input B shape is static and compatible with shape [N][n_blocks_per_col][blob_size], got: ",
b_shape);
CHECK_VALID_NODE(node,
@@ -74,11 +80,11 @@ ov::OutputVector matmulnbits(const ov::frontend::onnx::Node& node) {
CHECK_VALID_NODE(
node,
b_quantized.get_element_type() == ov::element::u8 || b_quantized.get_element_type() == ov::element::i32,
- "Unsupported input B type, accepted FP16, FP32, got: ",
+ "Unsupported input B type, accepted U8 or I32, got: ",
b_quantized.get_element_type());
CHECK_VALID_NODE(node,
- block_size >= 16 && (block_size % 2 == 0),
+ block_size >= 16 && (block_size & (block_size - 1)) == 0,
"Wrong block size, should be >=16 and be a power of 2, got: ",
block_size);
CHECK_VALID_NODE(node, accuracy_level >= 0 && accuracy_level <= 4, "Unsupported accuracy level: ", accuracy_level);
@@ -183,18 +189,25 @@ ov::OutputVector matmulnbits(const ov::frontend::onnx::Node& node) {
const auto zero_points_const = ov::as_type_ptr<v0::Constant>(zero_points.get_node_shared_ptr());
if (zero_points.get_element_type() == a.get_element_type()) {
- const uint64_t expected_zp_size = N * n_blocks_per_col * 1;
+ const uint64_t expected_zp_size = N * n_blocks_per_col;
const auto& zp_shape = zero_points.get_partial_shape();
- uint64_t actual_zp_size = 1;
- for (const auto& d : zp_shape) {
- actual_zp_size *= d.get_length();
- }
CHECK_VALID_NODE(node,
- zp_shape.is_static() && actual_zp_size == expected_zp_size,
+ zp_shape.is_static(),
"Expected input Zero Point shape is static and compatible with shape "
"[N][n_blocks_per_col][1], got: ",
zp_shape);
+ const auto zp_shape_static = zp_shape.get_shape();
+ uint64_t actual_zp_size = 1;
+ for (const auto dim : zp_shape_static) {
+ actual_zp_size *= dim;
+ }
+ CHECK_VALID_NODE(node,
+ actual_zp_size == expected_zp_size,
+ "Expected input Zero Point shape is compatible with shape [N][n_blocks_per_col][1], "
+ "got: ",
+ zp_shape);
+
ov::Shape casted_zp_shape = ov::Shape{static_cast<size_t>(N), static_cast<size_t>(n_blocks_per_col), 1};
converted_zero_points = std::make_shared<v0::Constant>(a.get_element_type(),
casted_zp_shape,
@@ -225,12 +238,12 @@ ov::OutputVector matmulnbits(const ov::frontend::onnx::Node& node) {
}
}
- // Possible issue with slice implementation, had to move convertion before slice, instead of slicing uint4
+ // Possible issue with slice implementation, had to move conversion before slice, instead of slicing uint4
// TODO: Ticket
// Comments: it is still there, so need to convert b to fp16 first.
// TODO: Need to collect performance data in case constant folding is applied. Possible some perf/mem-gap
- // Comments: in this latest code, the const folding is gone, it trigle the oneDNN kernel
+ // Comments: in this latest code, the const folding is gone; it triggers the oneDNN kernel
// and use u2/u4/u8 weights as the kernel's input, won't do const folding anymore.
// use fp16 for compute
diff --git a/src/frontends/onnx/frontend/src/op/com.microsoft/qlinear_activation.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/qlinear_activation.cpp
index 2e06556be84..ed01fda7947 100644
--- a/src/frontends/onnx/frontend/src/op/com.microsoft/qlinear_activation.cpp
+++ b/src/frontends/onnx/frontend/src/op/com.microsoft/qlinear_activation.cpp
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//
+#include "core/null_node.hpp"
#include "core/operator_set.hpp"
#include "exceptions.hpp"
#include "openvino/frontend/exception.hpp"
@@ -18,6 +19,7 @@
#include "openvino/op/sigmoid.hpp"
#include "openvino/op/softmax.hpp"
#include "openvino/op/subtract.hpp"
+#include "openvino/op/util/op_types.hpp"
#include "utils/common.hpp"
#include "utils/reshape.hpp"
@@ -37,10 +39,10 @@ ov::OutputVector qlinear_activation(const ov::frontend::onnx::Node& node, const
auto input_tensor = inputs[0];
auto input_scale = inputs[1];
auto input_zero_point =
- (inputs[2].get_shape().empty()) ? v0::Constant::create(input_tensor.get_element_type(), {}, {0}) : inputs[2];
+ ov::op::util::is_null(inputs[2]) ? v0::Constant::create(input_tensor.get_element_type(), {}, {0}) : inputs[2];
auto output_scale = inputs[3];
auto output_zero_point =
- (inputs.size() > 4) ? inputs[4] : v0::Constant::create(input_tensor.get_element_type(), {}, {0});
+ (common::is_input_valid(node, 4)) ? inputs[4] : v0::Constant::create(input_tensor.get_element_type(), {}, {0});
CHECK_VALID_NODE(node,
(input_tensor.get_element_type() == element::i8 || input_tensor.get_element_type() == element::u8),
@@ -59,7 +61,7 @@ ov::OutputVector qlinear_activation(const ov::frontend::onnx::Node& node, const
std::make_shared<v1::Add>(std::make_shared<v0::Convert>(scaled_result_float, input_tensor.get_element_type()),
output_zero_point);
- return ov::OutputVector{quantized_result};
+ return ov::OutputVector{quantized_result->output(0)};
}
ov::OutputVector qlinear_sigmoid(const ov::frontend::onnx::Node& node) {
@@ -86,8 +88,9 @@ ov::OutputVector qlinear_avg_pool(const ov::frontend::onnx::Node& node) {
const auto count_include_pad = node.get_attribute_value<int64_t>("count_include_pad", 0);
const auto auto_pad = node.get_attribute_value<std::string>("auto_pad", "NOTSET");
- const auto input_rank = input_dequantized->get_shape().size();
- const size_t num_spatial_dims = input_rank - 2;
+ const auto input_rank = input_dequantized->get_output_partial_shape(0).rank();
+ CHECK_VALID_NODE(node, input_rank.is_static(), "Input rank must be static for QLinearAveragePool");
+ const size_t num_spatial_dims = input_rank.get_length() - 2;
pads.resize(num_spatial_dims * 2, pads.size() == 1 ? pads[0] : 0);
strides.resize(num_spatial_dims, strides.size() == 1 ? strides[0] : 1);
diff --git a/src/frontends/onnx/frontend/src/op/com.microsoft/qlinear_concat.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/qlinear_concat.cpp
index fe6a2fc651a..5ceab0830b3 100644
--- a/src/frontends/onnx/frontend/src/op/com.microsoft/qlinear_concat.cpp
+++ b/src/frontends/onnx/frontend/src/op/com.microsoft/qlinear_concat.cpp
@@ -1,6 +1,7 @@
// Copyright (C) 2018-2026 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
+#include "core/null_node.hpp"
#include "core/operator_set.hpp"
#include "exceptions.hpp"
#include "openvino/frontend/exception.hpp"
@@ -10,6 +11,7 @@
#include "openvino/op/divide.hpp"
#include "openvino/op/multiply.hpp"
#include "openvino/op/subtract.hpp"
+#include "openvino/op/util/op_types.hpp"
#include "utils/common.hpp"
using namespace ov::op;
@@ -25,13 +27,15 @@ ov::OutputVector qlinear_concat(const ov::frontend::onnx::Node& node) {
auto inputs = node.get_ov_inputs();
auto Y_scale = inputs[0];
- auto Y_zero_point = inputs[1];
+ auto Y_zero_point =
+ ov::op::util::is_null(inputs[1]) ? v0::Constant::create(Y_scale.get_element_type(), {}, {0}) : inputs[1];
std::vector<std::shared_ptr<ov::Node>> dequantized_inputs;
for (size_t i = 2; i < inputs.size(); i += 3) {
auto X = inputs[i];
auto X_scale = inputs[i + 1];
- auto X_zero_point = inputs[i + 2];
+ auto X_zero_point =
+ ov::op::util::is_null(inputs[i + 2]) ? v0::Constant::create(X.get_element_type(), {}, {0}) : inputs[i + 2];
auto X_minus_zero_point = std::make_shared<v1::Subtract>(X, X_zero_point);
auto X_minus_zero_point_float = std::make_shared<v0::Convert>(X_minus_zero_point, X_scale.get_element_type());
@@ -49,7 +53,7 @@ ov::OutputVector qlinear_concat(const ov::frontend::onnx::Node& node) {
auto Y_float = std::make_shared<v1::Add>(requantized, Y_zero_point_float);
auto Y = std::make_shared<v0::Convert>(Y_float, inputs[2].get_element_type());
- return {Y};
+ return {Y->output(0)};
}
ONNX_OP("QLinearConcat", OPSET_SINCE(1), com_microsoft::opset_1::qlinear_concat, MICROSOFT_DOMAIN);
diff --git a/src/frontends/onnx/frontend/src/op/com.microsoft/qlinear_ops.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/qlinear_ops.cpp
index 00c64b053f2..5998b65f78d 100644
--- a/src/frontends/onnx/frontend/src/op/com.microsoft/qlinear_ops.cpp
+++ b/src/frontends/onnx/frontend/src/op/com.microsoft/qlinear_ops.cpp
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//
+#include "core/null_node.hpp"
#include "core/operator_set.hpp"
#include "exceptions.hpp"
#include "openvino/frontend/exception.hpp"
@@ -12,6 +13,7 @@
#include "openvino/op/multiply.hpp"
#include "openvino/op/reshape.hpp"
#include "openvino/op/subtract.hpp"
+#include "openvino/op/util/op_types.hpp"
#include "utils/common.hpp"
using namespace ov::op;
@@ -30,16 +32,17 @@ ov::OutputVector qlinear_op(const ov::frontend::onnx::Node& node, BinaryOp binar
auto A = inputs[0];
auto A_scale = inputs[1];
auto A_zero_point =
- (inputs[2].get_shape().empty()) ? v0::Constant::create(A.get_element_type(), {}, {0}) : inputs[2];
+ ov::op::util::is_null(inputs[2]) ? v0::Constant::create(A.get_element_type(), {}, {0}) : inputs[2];
auto B = inputs[3];
auto B_scale = inputs[4];
auto B_zero_point =
- (inputs[5].get_shape().empty()) ? v0::Constant::create(A.get_element_type(), {}, {0}) : inputs[5];
+ ov::op::util::is_null(inputs[5]) ? v0::Constant::create(B.get_element_type(), {}, {0}) : inputs[5];
auto C_scale = inputs[6];
- auto C_zero_point = inputs.size() > 7 ? inputs[7] : v0::Constant::create(C_scale.get_element_type(), {}, {0});
+ auto C_zero_point =
+ (common::is_input_valid(node, 7)) ? inputs[7] : v0::Constant::create(C_scale.get_element_type(), {}, {0});
CHECK_VALID_NODE(
node,
@@ -74,7 +77,7 @@ ov::OutputVector qlinear_op(const ov::frontend::onnx::Node& node, BinaryOp binar
auto C_float = std::make_shared<v1::Add>(result_divided, C_zero_point_float);
auto C = std::make_shared<v0::Convert>(C_float, A.get_element_type());
- return ov::OutputVector{C};
+ return ov::OutputVector{C->output(0)};
}
ov::OutputVector qlinear_add(const ov::frontend::onnx::Node& node) {
diff --git a/src/frontends/onnx/frontend/src/op/com.microsoft/quick_gelu.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/quick_gelu.cpp
index b5780ae2867..87125c68efa 100644
--- a/src/frontends/onnx/frontend/src/op/com.microsoft/quick_gelu.cpp
+++ b/src/frontends/onnx/frontend/src/op/com.microsoft/quick_gelu.cpp
@@ -34,8 +34,8 @@ ov::OutputVector quick_gelu(const ov::frontend::onnx::Node& node) {
"Unsupported input x type, accepted FP16, FP32, FP64, BFP16 but got: ",
element_type);
- // Get attribute from node
- const float alpha = node.get_attribute_value<float>("alpha");
+ constexpr auto ort_default = 1.702f;
+ const float alpha = node.get_attribute_value<float>("alpha", ort_default);
// Numpy broadcasting rule is automatically applied with mismatched shapes according to:
// https://docs.openvino.ai/2022.3/openvino_docs_ops_arithmetic_Multiply_1.html "Tensor with dimension of size 1
diff --git a/src/frontends/onnx/frontend/src/op/com.microsoft/rotary_embedding.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/rotary_embedding.cpp
index b7a00eabf0d..6c8a4aa7434 100644
--- a/src/frontends/onnx/frontend/src/op/com.microsoft/rotary_embedding.cpp
+++ b/src/frontends/onnx/frontend/src/op/com.microsoft/rotary_embedding.cpp
@@ -2,7 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
//
-#include "cmath"
+#include <cmath>
+
#include "core/operator_set.hpp"
#include "exceptions.hpp"
#include "openvino/core/graph_util.hpp"
@@ -77,13 +78,27 @@ ov::OutputVector rotary_embedding(const ov::frontend::onnx::Node& node) {
position_ids,
zero); // [seqlen, head_size/2] or [bs, seqlen, head_size/2]
+ const auto cos_cache_shape = cos_cache.get_partial_shape();
+ const auto cos_cache_rank = cos_cache_shape.rank();
+ CHECK_VALID_NODE(node,
+ cos_cache_rank.is_static() && cos_cache_rank.get_length() >= 1,
+ "cos_cache must have static rank with at least one dimension, got: ",
+ cos_cache_shape);
+ const auto last_dim = cos_cache_shape[cos_cache_rank.get_length() - 1];
+ CHECK_VALID_NODE(node,
+ last_dim.is_static(),
+ "cos_cache last dimension must be static to derive head size, got: ",
+ cos_cache_shape);
+ const auto headsize_val = static_cast<int64_t>(last_dim.get_length() * 2);
+
const auto input_shape = std::make_shared<v3::ShapeOf>(input);
- const bool input_is_3d = input.get_partial_shape().rank().get_length() == 3;
+ const auto input_rank = input.get_partial_shape().rank();
+ const bool input_is_3d = input_rank.is_static() && input_rank.get_length() == 3;
const auto perm = v0::Constant::create(ov::element::i64, ov::Shape{4}, {0, 2, 1, 3});
ov::Output<ov::Node> input_4d = input;
if (input_is_3d) {
- const auto headsize = v0::Constant::create(ov::element::i64, ov::Shape{1}, {cos_cache.get_shape()[-1] * 2});
+ const auto headsize = v0::Constant::create(ov::element::i64, ov::Shape{1}, {headsize_val});
const auto input_shape_prev_2 = get_dimensions(input_shape, {0, 1});
auto new_input_shape = std::make_shared<v0::Concat>(ov::NodeVector{input_shape_prev_2, minus_one, headsize}, 0);
auto input_reshaped =
@@ -95,7 +110,7 @@ ov::OutputVector rotary_embedding(const ov::frontend::onnx::Node& node) {
if (interleaved) {
auto input_4d_shape = std::make_shared<v3::ShapeOf>(input_4d);
auto dim_bns = get_dimensions(input_4d_shape, {0, 1, 2});
- auto half_head_size = v0::Constant::create(ov::element::i64, ov::Shape{1}, {cos_cache.get_shape()[-1]});
+ auto half_head_size = v0::Constant::create(ov::element::i64, ov::Shape{1}, {last_dim.get_length()});
auto split_input_shape = std::make_shared<v0::Concat>(ov::NodeVector{dim_bns, half_head_size, two}, 0);
auto reshaped_input = std::make_shared<v1::Reshape>(input_4d, split_input_shape, false);
diff --git a/src/frontends/onnx/frontend/src/op/com.microsoft/simplified_layer_normalization.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/simplified_layer_normalization.cpp
index 3735ebf5a72..a0dbb2d552f 100644
--- a/src/frontends/onnx/frontend/src/op/com.microsoft/simplified_layer_normalization.cpp
+++ b/src/frontends/onnx/frontend/src/op/com.microsoft/simplified_layer_normalization.cpp
@@ -37,7 +37,7 @@ ov::OutputVector simplified_layer_normalization(const ov::frontend::onnx::Node&
X.get_element_type(),
scale.get_element_type());
- float epsilon = node.get_attribute_value<float>("epsilon", 1e-5f);
+ float epsilon = node.get_attribute_value<float>("epsilon", 1e-12f);
int64_t axis = node.get_attribute_value<int64_t>("axis", -1);
int64_t default_stash_type = static_cast<int64_t>(TensorProto_DataType::TensorProto_DataType_FLOAT);
int64_t stash_type_i = node.get_attribute_value<int64_t>("stash_type", default_stash_type);
diff --git a/src/frontends/onnx/frontend/src/op/com.microsoft/skip_simplified_layer_normalization.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/skip_simplified_layer_normalization.cpp
index 3e63287c8a9..e2a4c7c2682 100644
--- a/src/frontends/onnx/frontend/src/op/com.microsoft/skip_simplified_layer_normalization.cpp
+++ b/src/frontends/onnx/frontend/src/op/com.microsoft/skip_simplified_layer_normalization.cpp
@@ -53,7 +53,7 @@ ov::OutputVector skip_simplified_layer_normalization(const ov::frontend::onnx::N
input = std::make_shared<v1::Add>(input, bias);
}
- float epsilon = node.get_attribute_value<float>("epsilon");
+ float epsilon = node.get_attribute_value<float>("epsilon", 1e-12f);
ov::element::Type element_type = input->get_output_element_type(0);
auto squared_input = std::make_shared<v1::Multiply>(input, input);
diff --git a/src/frontends/onnx/frontend/src/op/compress.cpp b/src/frontends/onnx/frontend/src/op/compress.cpp
index cca4accadfb..f4cbbedd529 100644
--- a/src/frontends/onnx/frontend/src/op/compress.cpp
+++ b/src/frontends/onnx/frontend/src/op/compress.cpp
@@ -24,9 +24,9 @@ ov::OutputVector compress(const ov::frontend::onnx::Node& node) {
if (node.has_attribute("axis")) {
axis = node.get_attribute_value<int64_t>("axis");
} else {
+ // When axis is absent, both inputs are flattened to 1D per ONNX spec.
data = std::make_shared<v0::Squeeze>(ov::op::util::flatten(data, static_cast<int>(axis)));
- data = std::make_shared<v0::Squeeze>(ov::op::util::flatten(data, static_cast<int>(axis)));
- data = std::make_shared<v0::Squeeze>(ov::op::util::flatten(data, static_cast<int>(axis)));
+ condition = std::make_shared<v0::Squeeze>(ov::op::util::flatten(condition, static_cast<int>(axis)));
}
auto axis_node = v0::Constant::create(ov::element::i64, ov::Shape{}, {axis});
auto zero_node = v0::Constant::create(ov::element::i64, ov::Shape{}, {0});
diff --git a/src/frontends/onnx/frontend/src/op/constant.cpp b/src/frontends/onnx/frontend/src/op/constant.cpp
index 3d8150034d3..01d6fbe559d 100644
--- a/src/frontends/onnx/frontend/src/op/constant.cpp
+++ b/src/frontends/onnx/frontend/src/op/constant.cpp
@@ -121,7 +121,7 @@ namespace detail {
ov::OutputVector constant_legacy(const ov::frontend::onnx::Node& node) {
auto attributes_names = node.get_attribute_names();
FRONT_END_GENERAL_CHECK(attributes_names.size() == 1,
- "The Constant op expects exactly one attribute."
+ "The Constant op expects exactly one attribute. "
"Got: ",
attributes_names.size());
diff --git a/src/frontends/onnx/frontend/src/op/conv_transpose.cpp b/src/frontends/onnx/frontend/src/op/conv_transpose.cpp
index 0ab8a82171e..affa1a1e9c6 100644
--- a/src/frontends/onnx/frontend/src/op/conv_transpose.cpp
+++ b/src/frontends/onnx/frontend/src/op/conv_transpose.cpp
@@ -145,7 +145,7 @@ ov::OutputVector conv_transpose(const ov::frontend::onnx::Node& node) {
std::pair<ov::CoordinateDiff, ov::CoordinateDiff> paddings;
ov::op::PadType auto_pad_type = convpool::get_auto_pad(node);
- // Get attirbutes or infer them from input data rank it it's static.
+ // Get attributes or infer them from input data rank if it's static.
if (data_pshape.rank().is_static()) {
num_spatial_dims = data_pshape.rank().get_length() - 2;
} else if (filters_pshape.rank().is_static()) {
diff --git a/src/frontends/onnx/frontend/src/op/crop.cpp b/src/frontends/onnx/frontend/src/op/crop.cpp
index 87e1a06b054..e8bc90e7bb7 100644
--- a/src/frontends/onnx/frontend/src/op/crop.cpp
+++ b/src/frontends/onnx/frontend/src/op/crop.cpp
@@ -23,7 +23,7 @@ ov::OutputVector crop(const ov::frontend::onnx::Node& node) {
const auto inputs = node.get_ov_inputs();
const auto& input_data = inputs.at(0);
- // Border values: leftBorder, topBorder, rightBorder, bottomBorder.
+ // Spec defines four borders (left, top, right, bottom); when scale is present only left/top are used.
const auto border = node.get_attribute_value<std::vector<std::int64_t>>("border");
std::shared_ptr<ov::Node> end;
@@ -35,6 +35,10 @@ ov::OutputVector crop(const ov::frontend::onnx::Node& node) {
// If scale is given, then start crop at left/top `border`
// and end on left/top `border` + `scale`.
if (node.has_attribute("scale")) {
+ CHECK_VALID_NODE(node,
+ border.size() >= 2,
+ "ONNX Crop with 'scale' expects at least 2 values in 'border' attribute, found: ",
+ border.size());
// List of ints height, width
const auto scale = node.get_attribute_value<std::vector<std::int64_t>>("scale");
@@ -53,9 +57,8 @@ ov::OutputVector crop(const ov::frontend::onnx::Node& node) {
else {
CHECK_VALID_NODE(node,
border.size() == 4,
- "ONNX Crop expects 4 values in 'border' attribute, found: ",
+ "ONNX Crop without 'scale' expects 4 values in 'border' attribute, found: ",
border.size());
-
// Calculate ends as shape(input) - border[2:3]
const auto input_shape = std::make_shared<v3::ShapeOf>(input_data);
const auto end_offset = v0::Constant::create(ov::element::i64,
diff --git a/src/frontends/onnx/frontend/src/op/dropout.cpp b/src/frontends/onnx/frontend/src/op/dropout.cpp
index bcfdd137a70..36a887419f3 100644
--- a/src/frontends/onnx/frontend/src/op/dropout.cpp
+++ b/src/frontends/onnx/frontend/src/op/dropout.cpp
@@ -36,7 +36,7 @@ ov::OutputVector build_dropout(const ov::frontend::onnx::Node& node, bool traini
namespace opset_12 {
ov::OutputVector dropout(const ov::frontend::onnx::Node& node) {
const auto ng_inputs = node.get_ov_inputs();
- // seed attribute and ratio input are ignored because traning mode is not
+ // seed attribute and ratio input are ignored because training mode is not
// supported anyway
bool training_mode = false; // default value
if (ng_inputs.size() > 2 && !ov::op::util::is_null(ng_inputs.at(2))) {
@@ -53,7 +53,7 @@ ONNX_OP("Dropout", OPSET_SINCE(12), ai_onnx::opset_12::dropout);
namespace opset_7 {
ov::OutputVector dropout(const ov::frontend::onnx::Node& node) {
// "is_test" attribute was removed
- // ratio attribute is ignored because traning mode is not supported
+ // ratio attribute is ignored because training mode is not supported
const bool training_mode = false;
return build_dropout(node, training_mode);
@@ -64,7 +64,7 @@ ONNX_OP("Dropout", OPSET_RANGE(7, 11), ai_onnx::opset_7::dropout);
namespace opset_1 {
ov::OutputVector dropout(const ov::frontend::onnx::Node& node) {
// legacy consumed_inputs attribute ignored
- // ratio attribute is ignored because traning mode is not supported
+ // ratio attribute is ignored because training mode is not supported
const bool training_mode = !node.get_attribute_value<int64_t>("is_test", 0);
return build_dropout(node, training_mode);
diff --git a/src/frontends/onnx/frontend/src/op/image_scaler.cpp b/src/frontends/onnx/frontend/src/op/image_scaler.cpp
index 1ab1c22a924..06cffcfdfa4 100644
--- a/src/frontends/onnx/frontend/src/op/image_scaler.cpp
+++ b/src/frontends/onnx/frontend/src/op/image_scaler.cpp
@@ -16,7 +16,7 @@ namespace ai_onnx {
namespace opset_1 {
ov::OutputVector image_scaler(const ov::frontend::onnx::Node& node) {
const auto inputs = node.get_ov_inputs();
- FRONT_END_GENERAL_CHECK(inputs.size() == 1, "ImageScaler 1 input tensor. Got: ", inputs.size());
+ FRONT_END_GENERAL_CHECK(inputs.size() == 1, "ImageScaler expects 1 input tensor. Got: ", inputs.size());
const auto data = inputs[0];
const auto& data_shape = data.get_partial_shape();
diff --git a/src/frontends/onnx/frontend/src/op/loop.cpp b/src/frontends/onnx/frontend/src/op/loop.cpp
index 04fca818f2b..9a284b914ec 100644
--- a/src/frontends/onnx/frontend/src/op/loop.cpp
+++ b/src/frontends/onnx/frontend/src/op/loop.cpp
@@ -93,7 +93,9 @@ ov::OutputVector loop_legacy(const ov::frontend::onnx::Node& node) {
const ov::OutputVector loop_carried_dependencies{std::next(ng_inputs.begin(), 2), ng_inputs.end()};
const auto& subgraphs = node.get_subgraphs();
- auto body_graph = subgraphs.at("body");
+ auto body_graph_it = subgraphs.find("body");
+ FRONT_END_GENERAL_CHECK(body_graph_it != subgraphs.end(), "Missing 'body' attribute in Loop subgraphs");
+ auto body_graph = body_graph_it->second;
auto body_outputs = body_graph->get_ov_outputs();
const auto& body_inputs = body_graph->get_ng_parameters();
@@ -116,7 +118,7 @@ ov::OutputVector loop_legacy(const ov::frontend::onnx::Node& node) {
trip_count = ng_inputs.at(0);
}
- ov::Output<ov::Node> termination_cond; // true means that first interation should be run
+ ov::Output<ov::Node> termination_cond; // true means that first iteration should be run
if (ov::op::util::is_null(ng_inputs.at(1).get_node_shared_ptr())) // termination condition skipped
{
termination_cond = v0::Constant::create(ov::element::boolean, {1}, {true});
diff --git a/src/frontends/onnx/frontend/src/op/lp_norm.cpp b/src/frontends/onnx/frontend/src/op/lp_norm.cpp
index 6804304d107..8ecb12feb69 100644
--- a/src/frontends/onnx/frontend/src/op/lp_norm.cpp
+++ b/src/frontends/onnx/frontend/src/op/lp_norm.cpp
@@ -27,7 +27,7 @@ ov::OutputVector lp_norm(const ov::frontend::onnx::Node& node) {
p_norm == 1 || p_norm == 2,
"Invalid `p` attribute value: ",
p_norm,
- "Only normalization of 1st or 2nd order is supported.");
+ " Only normalization of 1st or 2nd order is supported.");
const auto normalize_axis_const = v0::Constant::create(ov::element::i64, {}, {normalize_axis});
std::shared_ptr<ov::Node> norm =
diff --git a/src/frontends/onnx/frontend/src/op/lp_pool.cpp b/src/frontends/onnx/frontend/src/op/lp_pool.cpp
index 266e73f2463..044f8603b87 100644
--- a/src/frontends/onnx/frontend/src/op/lp_pool.cpp
+++ b/src/frontends/onnx/frontend/src/op/lp_pool.cpp
@@ -27,7 +27,7 @@ ov::OutputVector global_lp_pool(const ov::frontend::onnx::Node& node) {
FRONT_END_GENERAL_CHECK(data_shape.rank().is_static(), "Rank of input data must be static");
FRONT_END_GENERAL_CHECK(data_shape.rank().get_length() >= 2, "Rank of input data must be greater or equal to 2");
FRONT_END_GENERAL_CHECK(data_shape[0].is_static(), "First dimension of input data must be static");
- FRONT_END_GENERAL_CHECK(data_shape[channel_axis].is_static(), "Channel dimension of intput data must be static");
+ FRONT_END_GENERAL_CHECK(data_shape[channel_axis].is_static(), "Channel dimension of input data must be static");
const std::size_t channels_count = data_shape[channel_axis].get_length();
const std::int64_t p_norm{node.get_attribute_value<std::int64_t>("p", 2)};
diff --git a/src/frontends/onnx/frontend/src/op/lrn.cpp b/src/frontends/onnx/frontend/src/op/lrn.cpp
index 7669c411362..cab09f5b32c 100644
--- a/src/frontends/onnx/frontend/src/op/lrn.cpp
+++ b/src/frontends/onnx/frontend/src/op/lrn.cpp
@@ -14,10 +14,10 @@ namespace ai_onnx {
namespace opset_1 {
ov::OutputVector lrn(const ov::frontend::onnx::Node& node) {
auto data = node.get_ov_inputs().at(0);
- double alpha = node.get_attribute_value<double>("alpha", 1e-4);
- double beta = node.get_attribute_value<double>("beta", 0.75);
- double bias = node.get_attribute_value<double>("bias", 1);
- size_t size = node.get_attribute_value<size_t>("size");
+ const double alpha = node.get_attribute_value<double>("alpha", 1e-4);
+ const double beta = node.get_attribute_value<double>("beta", 0.75);
+ const double bias = node.get_attribute_value<double>("bias", 1);
+ const size_t size = node.get_attribute_value<size_t>("size");
return {std::make_shared<v0::LRN>(data, alpha, beta, bias, size)};
}
diff --git a/src/frontends/onnx/frontend/src/op/max_roi_pool.cpp b/src/frontends/onnx/frontend/src/op/max_roi_pool.cpp
index 359e53b9916..7e0600b333f 100644
--- a/src/frontends/onnx/frontend/src/op/max_roi_pool.cpp
+++ b/src/frontends/onnx/frontend/src/op/max_roi_pool.cpp
@@ -19,7 +19,7 @@ ov::OutputVector max_roi_pool(const ov::frontend::onnx::Node& node) {
OPENVINO_ASSERT(X.get_element_type() == ov::element::f16 || X.get_element_type() == ov::element::f32 ||
X.get_element_type() == ov::element::f64,
- "MaxRoiPool operator only supports float16, float32 and float64 datatypes.");
+ "MaxRoiPool operator only supports float16, float32, and float64 datatypes.");
const auto pooled_shape = node.get_attribute_value<std::vector<size_t>>("pooled_shape");
const auto spatial_scale = node.get_attribute_value<float>("spatial_scale", 1.0);
diff --git a/src/frontends/onnx/frontend/src/op/neg_log_like_loss.cpp b/src/frontends/onnx/frontend/src/op/neg_log_like_loss.cpp
index f70a8910d01..624d092d3d2 100644
--- a/src/frontends/onnx/frontend/src/op/neg_log_like_loss.cpp
+++ b/src/frontends/onnx/frontend/src/op/neg_log_like_loss.cpp
@@ -150,7 +150,7 @@ ov::OutputVector negative_log_likelihood_loss(const ov::frontend::onnx::Node& no
bool ignore_index = node.has_attribute("ignore_index") == true;
int64_t ignore_index_value = 0;
- // In some cases attributemay exists, but has an "undefined" type, which means for us "not exist"
+ // In some cases attribute may exist but have an "undefined" type, which we treat as missing.
if (ignore_index) {
const auto& attr = node.get_attribute("ignore_index");
ignore_index = attr.get_type() != Attribute::Type::undefined;
diff --git a/src/frontends/onnx/frontend/src/op/qlinear_matmul.cpp b/src/frontends/onnx/frontend/src/op/qlinear_matmul.cpp
index 1e66872acff..c443faf3c09 100644
--- a/src/frontends/onnx/frontend/src/op/qlinear_matmul.cpp
+++ b/src/frontends/onnx/frontend/src/op/qlinear_matmul.cpp
@@ -41,20 +41,20 @@ ov::OutputVector qlinear_matmul(const ov::frontend::onnx::Node& node) {
const auto& y_scale = inputs.at(6);
const auto& y_zero_point = inputs.at(7);
- const auto& dequnatize_a =
+ const auto& dequantize_a =
ai_onnx::opset_13::detail::dequantize_linear(a,
a_scale,
std::make_shared<v0::Convert>(a_zero_point, ov::element::f32),
1,
node);
- const auto& dequnatize_b =
+ const auto& dequantize_b =
ai_onnx::opset_13::detail::dequantize_linear(b,
b_scale,
std::make_shared<v0::Convert>(b_zero_point, ov::element::f32),
1,
node);
- const auto& result = ai_onnx::detail::matmul(dequnatize_a[0], dequnatize_b[0]);
+ const auto& result = ai_onnx::detail::matmul(dequantize_a[0], dequantize_b[0]);
const auto& quantized_result = ai_onnx::detail::make_fake_quantize(y_scale, y_zero_point, result[0]);
diff --git a/src/frontends/onnx/frontend/src/op/range.cpp b/src/frontends/onnx/frontend/src/op/range.cpp
index c3a16376dd2..0595ff8274e 100644
--- a/src/frontends/onnx/frontend/src/op/range.cpp
+++ b/src/frontends/onnx/frontend/src/op/range.cpp
@@ -24,16 +24,21 @@ ov::OutputVector range(const ov::frontend::onnx::Node& node) {
auto axes = std::make_shared<v0::Constant>(ov::element::i64, ov::Shape{}, std::vector<int64_t>{0});
- // Check if step is a tensor with a single value
- if (start.get_shape().size() == 1 && start.get_shape()[0] == 1) {
+ const auto is_singleton_vector = [](const ov::PartialShape& pshape) {
+ return pshape.rank().is_static() && pshape.rank().get_length() == 1 && pshape[0].is_static() &&
+ pshape[0].get_length() == 1;
+ };
+
+ // Squeeze 1D-tensors with single element into scalars for Range inputs
+ if (is_singleton_vector(start.get_partial_shape())) {
start = std::make_shared<v0::Squeeze>(start, axes);
}
- if (stop.get_shape().size() == 1 && stop.get_shape()[0] == 1) {
+ if (is_singleton_vector(stop.get_partial_shape())) {
stop = std::make_shared<v0::Squeeze>(stop, axes);
}
- if (step.get_shape().size() == 1 && step.get_shape()[0] == 1) {
+ if (is_singleton_vector(step.get_partial_shape())) {
step = std::make_shared<v0::Squeeze>(step, axes);
}
diff --git a/src/frontends/onnx/frontend/src/op/reduce.cpp b/src/frontends/onnx/frontend/src/op/reduce.cpp
index 15565a5a671..92acbe1754a 100644
--- a/src/frontends/onnx/frontend/src/op/reduce.cpp
+++ b/src/frontends/onnx/frontend/src/op/reduce.cpp
@@ -203,7 +203,7 @@ static bool register_multiple_translators(void) {
ONNX_OP_M("ReduceL2", OPSET_RANGE(1, 12), ai_onnx::opset_1::reduce_l2);
ONNX_OP_M("ReduceMax", OPSET_RANGE(1, 12), ai_onnx::opset_1::reduce_max);
ONNX_OP_M("ReduceMean", OPSET_RANGE(1, 12), ai_onnx::opset_1::reduce_mean);
- ONNX_OP_M("ReduceMin", {1, 12}, ai_onnx::opset_1::reduce_min);
+ ONNX_OP_M("ReduceMin", OPSET_RANGE(1, 12), ai_onnx::opset_1::reduce_min);
ONNX_OP_M("ReduceProd", OPSET_RANGE(1, 12), ai_onnx::opset_1::reduce_prod);
ONNX_OP_M("ReduceSum", OPSET_RANGE(1, 12), ai_onnx::opset_1::reduce_sum);
ONNX_OP_M("ReduceSumSquare", OPSET_RANGE(1, 12), ai_onnx::opset_1::reduce_sum_square);
@@ -265,7 +265,7 @@ static bool register_multiple_translators(void) {
ONNX_OP_M("ReduceLogSumExp", OPSET_RANGE(13, 17), ai_onnx::opset_13::reduce_log_sum_exp);
ONNX_OP_M("ReduceMax", OPSET_RANGE(13, 17), ai_onnx::opset_13::reduce_max);
ONNX_OP_M("ReduceMean", OPSET_RANGE(13, 17), ai_onnx::opset_13::reduce_mean);
- ONNX_OP_M("ReduceMin", {13, 17}, ai_onnx::opset_13::reduce_min);
+ ONNX_OP_M("ReduceMin", OPSET_RANGE(13, 17), ai_onnx::opset_13::reduce_min);
ONNX_OP_M("ReduceProd", OPSET_RANGE(13, 17), ai_onnx::opset_13::reduce_prod);
ONNX_OP_M("ReduceSum", OPSET_RANGE(13, 17), ai_onnx::opset_13::reduce_sum);
ONNX_OP_M("ReduceSumSquare", OPSET_RANGE(13, 17), ai_onnx::opset_13::reduce_sum_square);
@@ -324,7 +324,7 @@ static bool register_multiple_translators(void) {
ONNX_OP_M("ReduceLogSumExp", OPSET_SINCE(18), ai_onnx::opset_18::reduce_log_sum_exp);
ONNX_OP_M("ReduceMax", OPSET_RANGE(18, 19), ai_onnx::opset_18::reduce_max);
ONNX_OP_M("ReduceMean", OPSET_SINCE(18), ai_onnx::opset_18::reduce_mean);
- ONNX_OP_M("ReduceMin", {18, 19}, ai_onnx::opset_18::reduce_min);
+ ONNX_OP_M("ReduceMin", OPSET_RANGE(18, 19), ai_onnx::opset_18::reduce_min);
ONNX_OP_M("ReduceProd", OPSET_SINCE(18), ai_onnx::opset_18::reduce_prod);
ONNX_OP_M("ReduceSumSquare", OPSET_SINCE(18), ai_onnx::opset_18::reduce_sum_square);
return true;
diff --git a/src/frontends/onnx/frontend/src/op/scatter_elements.cpp b/src/frontends/onnx/frontend/src/op/scatter_elements.cpp
index e059820130b..c514a8d2243 100644
--- a/src/frontends/onnx/frontend/src/op/scatter_elements.cpp
+++ b/src/frontends/onnx/frontend/src/op/scatter_elements.cpp
@@ -35,7 +35,7 @@ ov::OutputVector scatter_elements(const ov::frontend::onnx::Node& node) {
CHECK_VALID_NODE(node,
false,
"Unsupported value of attribute: `reduction`. "
- "Supported modes: `none`, `add`, `mul`, `min`, `max`, got:",
+ "Supported modes: `none`, `add`, `mul`, `min`, `max`, got: ",
reduction_onnx);
}
} else {
diff --git a/src/frontends/onnx/frontend/src/op/scatter_nd.cpp b/src/frontends/onnx/frontend/src/op/scatter_nd.cpp
index 25894ec70ec..e70aafc15cc 100644
--- a/src/frontends/onnx/frontend/src/op/scatter_nd.cpp
+++ b/src/frontends/onnx/frontend/src/op/scatter_nd.cpp
@@ -24,7 +24,7 @@ ov::OutputVector scatter_nd(const ov::frontend::onnx::Node& node) {
const auto reduction = node.get_attribute_value<std::string>("reduction", "none");
CHECK_VALID_NODE(node,
reduction == "none",
- "Unsupported value of attribute: `reduction`. Only `none` is supported, got:",
+ "Unsupported value of attribute: `reduction`. Only `none` is supported, got: ",
reduction);
}
diff --git a/src/frontends/onnx/frontend/src/op/shape.cpp b/src/frontends/onnx/frontend/src/op/shape.cpp
index 41a31315aec..203352c155b 100644
--- a/src/frontends/onnx/frontend/src/op/shape.cpp
+++ b/src/frontends/onnx/frontend/src/op/shape.cpp
@@ -3,6 +3,7 @@
//
#include <cstdint>
+#include <limits>
#include "core/null_node.hpp"
#include "core/operator_set.hpp"
diff --git a/src/frontends/onnx/frontend/src/op/topk.cpp b/src/frontends/onnx/frontend/src/op/topk.cpp
index a6f3fde00aa..1c0fe96aff0 100644
--- a/src/frontends/onnx/frontend/src/op/topk.cpp
+++ b/src/frontends/onnx/frontend/src/op/topk.cpp
@@ -11,10 +11,18 @@ namespace {
/// \return Return the second input to the TopK node reshaped to a scalar.
ov::Output<ov::Node> get_k(const ov::frontend::onnx::Node& node) {
auto k_node = node.get_ov_inputs().at(1);
- FRONT_END_GENERAL_CHECK(shape_size(k_node.get_shape()) == 1,
- "ONNX TopK operator: 'K' parameter must contain a single positive value.",
+ const auto& k_pshape = k_node.get_partial_shape();
+
+ FRONT_END_GENERAL_CHECK(k_pshape.rank().is_dynamic() || k_pshape.rank().get_length() <= 1,
+ "ONNX TopK operator: 'K' input must be a scalar or 1D tensor.",
node);
+ if (k_pshape.rank().is_static() && k_pshape.rank().get_length() == 1 && k_pshape[0].is_static()) {
+ FRONT_END_GENERAL_CHECK(k_pshape[0].get_length() == 1,
+ "ONNX TopK operator: 'K' parameter must contain a single value.",
+ node);
+ }
+
return ov::frontend::onnx::reshape::interpret_as_scalar(k_node);
}
} // namespace
diff --git a/src/frontends/onnx/frontend/src/op/trilu.cpp b/src/frontends/onnx/frontend/src/op/trilu.cpp
index 46750caf55c..9599c28c4db 100644
--- a/src/frontends/onnx/frontend/src/op/trilu.cpp
+++ b/src/frontends/onnx/frontend/src/op/trilu.cpp
@@ -44,8 +44,15 @@ ov::OutputVector trilu(const ov::frontend::onnx::Node& node) {
// but we extend support to be able work with 1-D with length == 1
k = inputs[1];
auto axes = v0::Constant::create(ov::element::i64, ov::Shape{}, {0});
+
+ const auto k_pshape = k.get_partial_shape();
+ const auto is_singleton_vector = [](const ov::PartialShape& pshape) {
+ return pshape.rank().is_static() && pshape.rank().get_length() == 1 && pshape[0].is_static() &&
+ pshape[0].get_length() == 1;
+ };
+
// Check if k is a tensor with a single value
- if (k.get_shape().size() == 1 && k.get_shape()[0] == 1) {
+ if (is_singleton_vector(k_pshape)) {
k = std::make_shared<v0::Squeeze>(k, axes);
}
CHECK_VALID_NODE(node, k.get_partial_shape().compatible({}), "Trilu second input must be a scalar");
diff --git a/src/frontends/onnx/frontend/src/place.hpp b/src/frontends/onnx/frontend/src/place.hpp
index 4e055bce7b5..29c47b0a9aa 100644
--- a/src/frontends/onnx/frontend/src/place.hpp
+++ b/src/frontends/onnx/frontend/src/place.hpp
@@ -119,11 +119,11 @@ public:
Place::Ptr get_producing_operation(int input_port_index) const override;
Place::Ptr get_producing_operation(const std::string& input_port_name) const override;
- Place::Place::Ptr get_target_tensor() const override;
+ Place::Ptr get_target_tensor() const override;
Place::Ptr get_target_tensor(int output_port_index) const override;
Place::Ptr get_target_tensor(const std::string& output_name) const override;
- Place::Place::Ptr get_source_tensor() const override;
+ Place::Ptr get_source_tensor() const override;
Place::Ptr get_source_tensor(int input_port_index) const override;
Place::Ptr get_source_tensor(const std::string& input_name) const override;
diff --git a/src/frontends/onnx/frontend/src/translate_session.cpp b/src/frontends/onnx/frontend/src/translate_session.cpp
index 221d5a28614..b393e27654b 100644
--- a/src/frontends/onnx/frontend/src/translate_session.cpp
+++ b/src/frontends/onnx/frontend/src/translate_session.cpp
@@ -198,7 +198,7 @@ void TranslateSession::translate_graph(const ov::frontend::InputModel::Ptr& inpu
for (const auto& output : model_onnx->get_outputs()) {
const auto tensor = std::dynamic_pointer_cast<ov::frontend::onnx::TensorONNXPlace>(output);
FRONT_END_GENERAL_CHECK(tensor != nullptr,
- "Inputs of ov::frontend::onnx::InputModel must be TensorLitePlace instances");
+ "Inputs of ov::frontend::onnx::InputModel must be TensorONNXPlace instances");
const auto name = tensor->get_names()[0];
if (!m_tensor_values.count(name)) {
continue;
diff --git a/src/frontends/onnx/frontend/src/translate_session.hpp b/src/frontends/onnx/frontend/src/translate_session.hpp
index 8f529e44594..264a0090d52 100644
--- a/src/frontends/onnx/frontend/src/translate_session.hpp
+++ b/src/frontends/onnx/frontend/src/translate_session.hpp
@@ -14,7 +14,7 @@ namespace onnx {
class OperatorsBridge;
/// For one call of convert and decode method of Frontend, it creates one TranslateSession object to save data for the
-/// translation session: telemetry statistics, cache of convrted body graph models, operation translators (including
+/// translation session: telemetry statistics, cache of converted body graph models, operation translators (including
/// extensions) registered for this translation session.
class TranslateSession {
public:
diff --git a/src/frontends/onnx/frontend/src/utils/arg_min_max_factory.cpp b/src/frontends/onnx/frontend/src/utils/arg_min_max_factory.cpp
index 11ef65c45cd..392bdc472d3 100644
--- a/src/frontends/onnx/frontend/src/utils/arg_min_max_factory.cpp
+++ b/src/frontends/onnx/frontend/src/utils/arg_min_max_factory.cpp
@@ -60,7 +60,7 @@ ov::Output<ov::Node> ArgMinMaxFactory::make_topk_subgraph(v11::TopK::Mode mode)
// along axis, in the example this is equal to:
// dims_on_axis = 6
//
- // Now using two Substract ops calculate resulting index:
+ // Now using two Subtract ops calculate resulting index:
// res_index = dims_on_axis - topk->output(1) = 6 - 3 = 3
// result = res_index - 1 = 3 - 1 = 2
diff --git a/src/frontends/onnx/frontend/src/utils/onnx_internal.hpp b/src/frontends/onnx/frontend/src/utils/onnx_internal.hpp
index 4a01219bde5..88add1d3422 100644
--- a/src/frontends/onnx/frontend/src/utils/onnx_internal.hpp
+++ b/src/frontends/onnx/frontend/src/utils/onnx_internal.hpp
@@ -26,7 +26,7 @@ using ::ONNX_NAMESPACE::ModelProto;
/// to an ov::Model representation.
///
/// \note The function can be used only internally by OV components!
-/// Passing ModelProto between componets which use different protobuf
+/// Passing ModelProto between components which use different protobuf
/// library can cause segfaults. If stream parsing fails or the ONNX model
/// contains unsupported ops, the function throws an ov::Exception.
///
diff --git a/src/frontends/onnx/frontend/src/utils/reshape.hpp b/src/frontends/onnx/frontend/src/utils/reshape.hpp
index 85246432534..55d4ee37808 100644
--- a/src/frontends/onnx/frontend/src/utils/reshape.hpp
+++ b/src/frontends/onnx/frontend/src/utils/reshape.hpp
@@ -77,7 +77,7 @@ std::shared_ptr<Node> reshape(const Output<Node>& value, const Shape& shape);
/// \brief Permute axes according to specified axes_order parameter.
///
-/// \param The vlaue whose axes we want to permute.
+/// \param The value whose axes we want to permute.
/// \param axes_order The permutation of axes.
///
/// \return Transpose:v1 op.
diff --git a/src/frontends/onnx/frontend/src/utils/variadic.hpp b/src/frontends/onnx/frontend/src/utils/variadic.hpp
index ba75fbff86d..e7a0cae49bf 100644
--- a/src/frontends/onnx/frontend/src/utils/variadic.hpp
+++ b/src/frontends/onnx/frontend/src/utils/variadic.hpp
@@ -16,7 +16,7 @@ namespace variadic {
/// \brief Create an OpenVINO version of an ONNX variadic operation.
/// This creates a subgraph with a series of binary operations.
///
-/// \param node Incoming ONNX opearation.
+/// \param node Incoming ONNX operation.
///
/// \tparam T Class of an OpenVINO binary operation (e.g. Add, Minimum, Maximum)
///
diff --git a/src/frontends/onnx/frontend/src/version_range.hpp b/src/frontends/onnx/frontend/src/version_range.hpp
index 44564168b7b..9bf78abadfb 100644
--- a/src/frontends/onnx/frontend/src/version_range.hpp
+++ b/src/frontends/onnx/frontend/src/version_range.hpp
@@ -20,7 +20,7 @@ struct VersionRange {
static constexpr VersionRange in(int version) {
return VersionRange{version, version};
}
- // -1 means that that a left/right boundary of the range was not specified
+ // -1 means that a left/right boundary of the range was not specified
const int m_since = -1, m_until = -1;
};
diff --git a/src/frontends/onnx/onnx_common/include/onnx_common/utils.hpp b/src/frontends/onnx/onnx_common/include/onnx_common/utils.hpp
index 56a0f5e1d82..fbbc70624eb 100644
--- a/src/frontends/onnx/onnx_common/include/onnx_common/utils.hpp
+++ b/src/frontends/onnx/onnx_common/include/onnx_common/utils.hpp
@@ -13,33 +13,33 @@ namespace common {
using ::ONNX_NAMESPACE::TensorProto_DataType;
using ::ONNX_NAMESPACE::TensorShapeProto;
-/// \brief Retuns size of an ONNX data type in bytes.
+/// \brief Returns size of an ONNX data type in bytes.
///
/// \param onnx_type Number assigned to an ONNX data type in the TensorProto_DataType enum.
///
size_t get_onnx_data_size(int32_t onnx_type);
-/// \brief Retuns a OpenVINO data type corresponding to an ONNX type.
+/// \brief Returns a OpenVINO data type corresponding to an ONNX type.
///
/// \param onnx_type An element of TensorProto_DataType enum which determines an ONNX type.
///
ov::element::Type_t onnx_to_ov_data_type(const TensorProto_DataType& onnx_type);
-/// \brief Retuns an ONNX data type corresponding to a OpenVINO data type.
+/// \brief Returns an ONNX data type corresponding to a OpenVINO data type.
///
/// \param ov_type An element of ov::element::Type_t enum class which determines a OpenVINO data
/// type.
///
TensorProto_DataType ov_to_onnx_data_type(const ov::element::Type_t& ov_type);
-/// \brief Retuns true if a OpenVINO data type is mapped to an ONNX data type.
+/// \brief Returns true if a OpenVINO data type is mapped to an ONNX data type.
///
/// \param ov_type An element of ov::element::Type_t enum class which determines a OpenVINO data
/// type.
///
bool is_supported_ov_type(const ov::element::Type_t& ov_type);
-/// \brief Retuns OpenVINO PartialShape based on onnx_shape.
+/// \brief Returns OpenVINO PartialShape based on onnx_shape.
///
/// \param onnx_shape A shape of tensor represented in ONNX way.
///
diff --git a/src/frontends/onnx/tests/CMakeLists.txt b/src/frontends/onnx/tests/CMakeLists.txt
index c14e8a7565d..b2fb4a5a3bc 100644
--- a/src/frontends/onnx/tests/CMakeLists.txt
+++ b/src/frontends/onnx/tests/CMakeLists.txt
@@ -20,7 +20,7 @@ list(APPEND ONNX_TESTS_DEPENDENCIES openvino_template_extension)
if (ENABLE_INTEL_CPU)
set(ACTIVE_BACKEND_LIST ${ACTIVE_BACKEND_LIST} "IE:CPU")
if (ENABLE_STRICT_DEPENDENCIES)
- # For convinience add a runtime dependency to build along with this target.
+ # For convenience add a runtime dependency to build along with this target.
# Warning: Parallel build with -GNinja may not be efficient.
list(APPEND ONNX_TESTS_DEPENDENCIES openvino_intel_cpu_plugin)
endif()
@@ -29,7 +29,7 @@ endif()
if (ENABLE_INTEL_GPU)
set(ACTIVE_BACKEND_LIST ${ACTIVE_BACKEND_LIST} "IE:GPU")
if (ENABLE_STRICT_DEPENDENCIES)
- # For convinience add a runtime dependency to build along with this target.
+ # For convenience add a runtime dependency to build along with this target.
# Warning: Parallel build with -GNinja may not be efficient.
list(APPEND ONNX_TESTS_DEPENDENCIES openvino_intel_gpu_plugin)
endif()
diff --git a/src/frontends/onnx/tests/models/dft_inversed_lenght_provided.prototxt b/src/frontends/onnx/tests/models/dft_inverse_length_provided.prototxt
similarity index 100%
rename from src/frontends/onnx/tests/models/dft_inversed_lenght_provided.prototxt
rename to src/frontends/onnx/tests/models/dft_inverse_length_provided.prototxt
diff --git a/src/frontends/onnx/tests/models/dft_inverse_lenght_provided_onesided.prototxt b/src/frontends/onnx/tests/models/dft_inverse_length_provided_onesided.prototxt
similarity index 100%
rename from src/frontends/onnx/tests/models/dft_inverse_lenght_provided_onesided.prototxt
rename to src/frontends/onnx/tests/models/dft_inverse_length_provided_onesided.prototxt
diff --git a/src/frontends/onnx/tests/models/dft_lenght_provided.prototxt b/src/frontends/onnx/tests/models/dft_length_provided.prototxt
similarity index 100%
rename from src/frontends/onnx/tests/models/dft_lenght_provided.prototxt
rename to src/frontends/onnx/tests/models/dft_length_provided.prototxt
diff --git a/src/frontends/onnx/tests/models/dft_lenght_provided_onesided.prototxt b/src/frontends/onnx/tests/models/dft_length_provided_onesided.prototxt
similarity index 100%
rename from src/frontends/onnx/tests/models/dft_lenght_provided_onesided.prototxt
rename to src/frontends/onnx/tests/models/dft_length_provided_onesided.prototxt
diff --git a/src/frontends/onnx/tests/onnx_import_dyn_shapes.in.cpp b/src/frontends/onnx/tests/onnx_import_dyn_shapes.in.cpp
index 775525e77a0..ddfd8091ce1 100644
--- a/src/frontends/onnx/tests/onnx_import_dyn_shapes.in.cpp
+++ b/src/frontends/onnx/tests/onnx_import_dyn_shapes.in.cpp
@@ -100,7 +100,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_dyn_shapes_ab_plus_c_inference) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_dyn_shapes_scalar_initializers_shape_check) {
- // initializers defined witout the "dims" field should produce Constants with an empty Shape
+ // initializers defined without the "dims" field should produce Constants with an empty Shape
// initializers with "dims: 0" should be have the same way (Shape{} not Shape{0})
const auto model = convert_model("dynamic_shapes/scalar_initializers.onnx");
diff --git a/src/frontends/onnx/tests/onnx_import_quant.in.cpp b/src/frontends/onnx/tests/onnx_import_quant.in.cpp
index 4a54f3093ed..ceb2f977846 100644
--- a/src/frontends/onnx/tests/onnx_import_quant.in.cpp
+++ b/src/frontends/onnx/tests/onnx_import_quant.in.cpp
@@ -547,7 +547,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dynamic_quantize_linear_3x4) {
auto test_case = ov::test::TestCase(model, s_device);
- // don't change style for better readibility
+ // don't change style for better readability
// clang-format off
test_case.add_input<float>({1.0f, 2.1f, 1.3f, 2.5f,
3.34f, 4.0f, 1.5f, 2.6f,
@@ -567,7 +567,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_quant_conv_linear) {
auto test_case = ov::test::TestCase(model, s_device);
- // don't change style for better readibility
+ // don't change style for better readability
// clang-format off
test_case.add_input(std::vector<uint8_t>{ 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18,
@@ -617,7 +617,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_quant_conv_linear_3d) {
auto test_case = ov::test::TestCase(model, s_device);
- // don't change style for better readibility
+ // don't change style for better readability
// clang-format off
test_case.add_input(std::vector<uint8_t>{130, 14, 244, 53,
244, 119, 236, 79,
@@ -675,7 +675,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_quant_conv_linear_onnx_example) {
auto test_case = ov::test::TestCase(model, s_device);
- // don't change style for better readibility
+ // don't change style for better readability
// clang-format off
test_case.add_input(std::vector<uint8_t>{255, 174, 162, 25, 203, 168, 58,
15, 59, 237, 95, 129, 0, 64,
@@ -726,7 +726,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_matmul_integer_2d_simple_zero_point) {
auto test_case = ov::test::TestCase(model, s_device);
- // don't change style for better readibility
+ // don't change style for better readability
// clang-format off
test_case.add_input(std::vector<uint8_t>{11, 7, 3,
10, 6, 2,
@@ -751,7 +751,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_matmul_integer_int8) {
auto test_case = ov::test::TestCase(model, s_device);
- // don't change style for better readibility
+ // don't change style for better readability
// clang-format off
test_case.add_input(std::vector<int8_t>{-3, 7, 5, -6,
4, -5, 8, 7}); // A
@@ -773,7 +773,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_matmul_integer_vectorized_zero_point)
auto test_case = ov::test::TestCase(model, s_device);
- // don't change style for better readibility
+ // don't change style for better readability
// clang-format off
test_case.add_input(std::vector<uint8_t>{11, 22, 33, 44, 55,
22, 33, 44, 55, 66,
@@ -800,7 +800,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_matmul_integer_no_zero_point) {
auto test_case = ov::test::TestCase(model, s_device);
- // don't change style for better readibility
+ // don't change style for better readability
// clang-format off
test_case.add_input(std::vector<uint8_t>{11, 22, 33, 44, 55,
22, 33, 44, 55, 66,
@@ -825,7 +825,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_matmul_integer_2d_x_3d) {
auto test_case = ov::test::TestCase(model, s_device);
- // don't change style for better readibility
+ // don't change style for better readability
// clang-format off
test_case.add_input(std::vector<int8_t>{7, -3, 1, 2,
0, 2, -4, 6}); // A
@@ -854,7 +854,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_matmul_integer_3d_x_2d) {
auto test_case = ov::test::TestCase(model, s_device);
- // don't change style for better readibility
+ // don't change style for better readability
// clang-format off
test_case.add_input(std::vector<int8_t>{-13, 11, -1, -2,
4, -2, 3, 10,
@@ -882,7 +882,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_matmul_integer_3d) {
auto test_case = ov::test::TestCase(model, s_device);
- // don't change style for better readibility
+ // don't change style for better readability
// clang-format off
test_case.add_input(std::vector<uint8_t>{125, 135, 145, 155,
130, 140, 150, 160,
@@ -916,7 +916,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_matmul_integer_4d) {
auto test_case = ov::test::TestCase(model, s_device);
- // don't change style for better readibility
+ // don't change style for better readability
// clang-format off
test_case.add_input(std::vector<uint8_t>{0, 1, 2, 3,
4, 5, 6, 7,
@@ -954,7 +954,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_matmul_integer_4d_zero_point) {
auto test_case = ov::test::TestCase(model, s_device);
- // don't change style for better readibility
+ // don't change style for better readability
// clang-format off
test_case.add_input(std::vector<uint8_t>{0, 1, 2, 3,
4, 5, 6, 7,
@@ -991,7 +991,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_matmul_integer_matrix_zero_point) {
auto test_case = ov::test::TestCase(model, s_device);
- // don't change style for better readibility
+ // don't change style for better readability
// clang-format off
test_case.add_input(std::vector<int8_t>{0, 1, 2, 3,
4, 5, 6, 7,
@@ -1051,7 +1051,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_conv_integer_simple_zero_point) {
auto test_case = ov::test::TestCase(model, s_device);
- // don't change style for better readibility
+ // don't change style for better readability
// clang-format off
test_case.add_input(std::vector<uint8_t>{11, 22, 33,
44, 55, 66,
@@ -1092,7 +1092,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_conv_integer_int8) {
auto test_case = ov::test::TestCase(model, s_device);
- // don't change style for better readibility
+ // don't change style for better readability
// clang-format off
test_case.add_input(std::vector<int8_t>{-11, 22, -33,
44, -55, 66,
@@ -1113,7 +1113,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_conv_integer_no_zero_point) {
auto test_case = ov::test::TestCase(model, s_device);
- // don't change style for better readibility
+ // don't change style for better readability
// clang-format off
test_case.add_input(std::vector<int8_t>{-100, -89, -78,
-67, -56, -45,
@@ -1132,7 +1132,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_conv_integer_vector_w_zero_point) {
auto test_case = ov::test::TestCase(model, s_device);
- // don't change style for better readibility
+ // don't change style for better readability
// clang-format off
test_case.add_input(std::vector<uint8_t>{11, 22, 33, 44,
55, 66, 77, 88,
@@ -1175,7 +1175,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_conv_integer_overload) {
auto test_case = ov::test::TestCase(model, s_device);
- // don't change style for better readibility
+ // don't change style for better readability
// clang-format off
test_case.add_input(std::vector<uint8_t>{255, 255, 255,
0, 0, 0,
diff --git a/src/frontends/onnx/tests/onnx_import_signal.in.cpp b/src/frontends/onnx/tests/onnx_import_signal.in.cpp
index 3527f35b2dc..e803e7a54b6 100644
--- a/src/frontends/onnx/tests/onnx_import_signal.in.cpp
+++ b/src/frontends/onnx/tests/onnx_import_signal.in.cpp
@@ -112,7 +112,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_onesided_skip_convert_to_complex)
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_length_provided) {
- auto model = convert_model("dft_lenght_provided.onnx");
+ auto model = convert_model("dft_length_provided.onnx");
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(Shape{3, 5, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f,
3.000000f, 0.000000f, 4.000000f, 0.000000f, 5.000000f, 0.000000f,
@@ -138,7 +138,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_scalar_length_provided) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_length_provided_onesided) {
- auto model = convert_model("dft_lenght_provided_onesided.onnx");
+ auto model = convert_model("dft_length_provided_onesided.onnx");
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(Shape{4, 3},
{0.000000f,
@@ -229,8 +229,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_onesided_real_input) {
{0.750000f, -0.250000f, -0.500000f, 0.250000f, 0.250000f, -0.500000f});
}
-OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_inversed_length_provided) {
- auto model = convert_model("dft_inversed_lenght_provided.onnx");
+OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_length_provided) {
+ auto model = convert_model("dft_inverse_length_provided.onnx");
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(Shape{3, 5, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f,
3.000000f, 0.000000f, 4.000000f, 0.000000f, 5.000000f, 0.000000f,
@@ -243,7 +243,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_inversed_length_provided) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_length_provided_onesided) {
- auto model = convert_model("dft_inverse_lenght_provided_onesided.onnx");
+ auto model = convert_model("dft_inverse_length_provided_onesided.onnx");
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(Shape{1, 3, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f});
test_case.add_expected_output<float>(Shape{4, 3},
diff --git a/src/frontends/onnx/tests/onnx_importer_test.cpp b/src/frontends/onnx/tests/onnx_importer_test.cpp
index 8f50e96e51a..fdf22dc035d 100644
--- a/src/frontends/onnx/tests/onnx_importer_test.cpp
+++ b/src/frontends/onnx/tests/onnx_importer_test.cpp
@@ -91,7 +91,7 @@ TEST(ONNX_Importer_Tests, ImportModelWithMultiOutput) {
TEST(ONNX_Importer_Tests, ImportModelWithNotSupportedOp) {
try {
auto model = convert_model("not_supported.onnx");
- FAIL() << "Any expection was thrown despite the ONNX model is not supported";
+ FAIL() << "No exception was thrown despite the ONNX model not being supported";
} catch (const Exception& error) {
EXPECT_PRED_FORMAT2(testing::IsSubstring,
std::string("OpenVINO does not support the following ONNX operations: NotSupported"),
diff --git a/src/frontends/onnx/tests/tests_python/test_zoo_models.py b/src/frontends/onnx/tests/tests_python/test_zoo_models.py
index 99de5863e79..431854ba6fc 100644
--- a/src/frontends/onnx/tests/tests_python/test_zoo_models.py
+++ b/src/frontends/onnx/tests/tests_python/test_zoo_models.py
@@ -132,7 +132,7 @@ def tolerance_map_key_in_model_path(path):
return None
zoo_models = []
-# rglob doesn't work for symlinks, so models have to be physically somwhere inside "MODELS_ROOT_DIR"
+# rglob doesn't work for symlinks, so models have to be physically somewhere inside "MODELS_ROOT_DIR"
for path in Path(MODELS_ROOT_DIR).rglob("*.onnx"):
mdir = path.parent
file_name = path.name
diff --git a/src/frontends/paddle/src/input_model.cpp b/src/frontends/paddle/src/input_model.cpp
index f2ffb35e737..a8661e5dafe 100644
--- a/src/frontends/paddle/src/input_model.cpp
+++ b/src/frontends/paddle/src/input_model.cpp
@@ -434,9 +434,9 @@ void InputModel::InputModelImpl::create_temp_consts() {
// as its output. e.g. the tensorarray is both the input and output of the same node.
// So we have to create a fake empty node here.
// Problem is, we have no idea which axis should be 0.
- // Since the models (faster/mask rcnn) are either concating tensors in tensorarray along the dynamic
- // dimension, or concating static shape tensors. So we make the dynamic dimension to be 0. In case of static
- // shape, we simply the the first dimension be 0.
+ // Since the models (faster/mask rcnn) are either concatenating tensors in tensorarray along the dynamic
+ // dimension, or concatenating static shape tensors. So we make the dynamic dimension to be 0. In case of
+ // static shape, we simply set the first dimension to 0.
if (var_desc.type().has_tensor_array()) {
const auto& tensor = var_desc.type().tensor_array().tensor();
const auto& type = get_ov_type(tensor.data_type());
diff --git a/src/frontends/paddle/src/internal/pass/transform_tensorarray.cpp b/src/frontends/paddle/src/internal/pass/transform_tensorarray.cpp
index 5464655169b..f5d41809c6e 100644
--- a/src/frontends/paddle/src/internal/pass/transform_tensorarray.cpp
+++ b/src/frontends/paddle/src/internal/pass/transform_tensorarray.cpp
@@ -34,7 +34,7 @@ ov::frontend::paddle::pass::TransformTensorArray::TransformTensorArray(std::vect
const auto& list = shape_node->get_input_node_shared_ptr(0);
const auto& new_item_unsqueeze = std::make_shared<Unsqueeze>(
new_item->output(0),
- Constant::create(element::i32, {1}, {0})); // unsqueeze in order to handyfully slice a tensorarray
+ Constant::create(element::i32, {1}, {0})); // unsqueeze in order to slice a tensorarray easily
// remove TensorArrayLength->TensorArrayWrite
const auto concat = std::make_shared<Concat>(OutputVector{list->output(0), new_item_unsqueeze->output(0)}, 1);
// prevent to remove concating zero-tensor
diff --git a/src/frontends/paddle/src/op/dequantize_linear.cpp b/src/frontends/paddle/src/op/dequantize_linear.cpp
index ccc2dc9e6be..65c67c9f2fd 100644
--- a/src/frontends/paddle/src/op/dequantize_linear.cpp
+++ b/src/frontends/paddle/src/op/dequantize_linear.cpp
@@ -38,7 +38,7 @@ NamedOutputs dequantize_linear(const NodeContext& node) {
const auto real_scale = std::make_shared<default_opset::Multiply>(scale, range_node);
auto q_node = std::make_shared<default_opset::Convert>(x, element::f32);
- // extract the ATTRIBUTES and explaination for quant_axis:
+ // extract the ATTRIBUTES and explanation for quant_axis:
// / [-1] --- per-tensor, scale is always 1-D
// quant_axis - [0 or 1] --- per-channel, scale may be 1-D or 2-D, needing to reshape for input shape.
// \ [others] --- unsupported
diff --git a/src/frontends/paddle/src/op/expand_v2.cpp b/src/frontends/paddle/src/op/expand_v2.cpp
index 9516e52d2e4..b2e28f36c2c 100644
--- a/src/frontends/paddle/src/op/expand_v2.cpp
+++ b/src/frontends/paddle/src/op/expand_v2.cpp
@@ -52,7 +52,7 @@ NamedOutputs expand_v2(const NodeContext& node) {
// add axis
const auto fixed_input_shape_node = std::make_shared<Concat>(NodeVector{rank_idx, input_shape_node_shape}, 0);
- // if -1 in shape we will copy the orginal value from input
+ // if -1 in shape we will copy the original value from input
auto zero_node = Constant::create(ov::element::i32, {1}, {0});
auto mask_node = std::make_shared<Greater>(shape_expected_node, zero_node);
auto fixed_shape_node = std::make_shared<Select>(mask_node, shape_expected_node, fixed_input_shape_node);
diff --git a/src/frontends/paddle/src/op/layer_norm.cpp b/src/frontends/paddle/src/op/layer_norm.cpp
index dff7eeb8396..dc1bebaf3b3 100644
--- a/src/frontends/paddle/src/op/layer_norm.cpp
+++ b/src/frontends/paddle/src/op/layer_norm.cpp
@@ -29,7 +29,7 @@ NamedOutputs layer_norm(const NodeContext& node) {
dims_node,
Constant::create(element::i64, {}, {1}),
element::i64);
- // 'Scale' and 'Bias' are in plain, shoule get the real shape. The shape: shape_of_node[begin_norm_axis:-1]
+ // 'Scale' and 'Bias' are in plain, should get the real shape. The shape: shape_of_node[begin_norm_axis:-1]
const auto scale_bias_shape = std::make_shared<StridedSlice>(shape_of_node,
Constant::create(element::i64, {1}, {begin_norm_axis}),
Constant::create(element::i64, {1}, {0}),
diff --git a/src/frontends/paddle/src/op/linspace.cpp b/src/frontends/paddle/src/op/linspace.cpp
index 141c06aef66..8ae792cf3cb 100644
--- a/src/frontends/paddle/src/op/linspace.cpp
+++ b/src/frontends/paddle/src/op/linspace.cpp
@@ -22,9 +22,9 @@ NamedOutputs linspace(const NodeContext& node) {
// compute step value, i.e. distance between neighbor values of the result
Output<Node> step = std::make_shared<default_opset::Subtract>(stop, start); //[-1]
auto const_one = std::make_shared<default_opset::Constant>(element::i32, Shape{}, 1);
- Output<Node> num_minus_one = std::make_shared<default_opset::Subtract>(num, const_one); //[3]
- auto num_none_zero = std::make_shared<default_opset::Greater>(num_minus_one, const_one); //[ture]
- num_minus_one = std::make_shared<default_opset::Select>(num_none_zero, num_minus_one, const_one);
+ Output<Node> num_minus_one = std::make_shared<default_opset::Subtract>(num, const_one); //[3]
+ auto num_non_zero = std::make_shared<default_opset::Greater>(num_minus_one, const_one); //[true]
+ num_minus_one = std::make_shared<default_opset::Select>(num_non_zero, num_minus_one, const_one);
num_minus_one = std::make_shared<default_opset::Convert>(num_minus_one, element::f32);
step = std::make_shared<default_opset::Divide>(step, num_minus_one); //[-1/3]
diff --git a/src/frontends/paddle/src/op/roi_align.cpp b/src/frontends/paddle/src/op/roi_align.cpp
index 00c1aaedeec..daa7d788378 100644
--- a/src/frontends/paddle/src/op/roi_align.cpp
+++ b/src/frontends/paddle/src/op/roi_align.cpp
@@ -25,7 +25,9 @@ NamedOutputs roi_align(const NodeContext& node) {
// TODO: support multiple batches #83232
if (data_node.get_partial_shape().rank().is_static() && data_node.get_partial_shape()[0].is_static())
- PADDLE_OP_CHECK(node, data_node.get_partial_shape()[0] == 1, "roi_align currenty only support batch_size = 1!");
+ PADDLE_OP_CHECK(node,
+ data_node.get_partial_shape()[0] == 1,
+ "roi_align currently only support batch_size = 1!");
const auto roi_node_shape = std::make_shared<default_opset::ShapeOf>(roi_node, element::i32);
const auto start = default_opset::Constant::create(element::i64, {1}, {0});
diff --git a/src/frontends/paddle/src/op/set_value.cpp b/src/frontends/paddle/src/op/set_value.cpp
index d46e27ad571..176ded1372d 100644
--- a/src/frontends/paddle/src/op/set_value.cpp
+++ b/src/frontends/paddle/src/op/set_value.cpp
@@ -192,7 +192,7 @@ NamedOutputs set_value(const NodeContext& node) {
} else
PADDLE_OP_CHECK(node, (false), "Invalid arguments!");
- // for unsepcified end: x[::2], end will be 2147483647
+ // for unspecified end: x[::2], end will be 2147483647
ends = handle_maximum_index(ends, spec_dim_node);
// 3.1 get starts node
diff --git a/src/frontends/paddle/src/op/stack.cpp b/src/frontends/paddle/src/op/stack.cpp
index 34c24b876f8..e43ad14768e 100644
--- a/src/frontends/paddle/src/op/stack.cpp
+++ b/src/frontends/paddle/src/op/stack.cpp
@@ -11,10 +11,10 @@ namespace paddle {
namespace op {
using namespace default_opset;
NamedOutputs stack(const NodeContext& node) {
- auto datas = node.get_ng_inputs("X");
+ auto data_inputs = node.get_ng_inputs("X");
auto axis = node.get_attribute<int32_t>("axis", 0);
- auto data_shape = datas[0].get_partial_shape();
- auto data_type = datas[0].get_element_type();
+ auto data_shape = data_inputs[0].get_partial_shape();
+ auto data_type = data_inputs[0].get_element_type();
OutputVector node_datas_reshape;
auto axis_const = std::make_shared<Constant>(element::i64, Shape{}, axis);
@@ -23,7 +23,7 @@ NamedOutputs stack(const NodeContext& node) {
(axis >= -(data_shape.rank().get_length() + 1)) && axis < (data_shape.rank().get_length() + 1),
"axis range is [-(R+1), R+1)!");
- for (const auto& data : datas) {
+ for (const auto& data : data_inputs) {
PADDLE_OP_CHECK(node,
data_type == data.get_element_type(),
"stack input tensor must have the same data types!");
diff --git a/src/frontends/paddle/src/op/tensor_array_to_tensor.cpp b/src/frontends/paddle/src/op/tensor_array_to_tensor.cpp
index 643fc66b7e9..e8178e438c5 100644
--- a/src/frontends/paddle/src/op/tensor_array_to_tensor.cpp
+++ b/src/frontends/paddle/src/op/tensor_array_to_tensor.cpp
@@ -16,11 +16,11 @@ namespace op {
// 1. TensorArray could be indexed with paddle slice op.
// We only support slice along axis 0 with only 1 element in TensorArray for now,
// with unsqueezing the element along axis 0 manually.
-// 2. TensoArray could be tranfered to tensor with paddle tensor_array_to_tensor op.
-// The elements in it should be concated along an axis.
+// 2. TensorArray could be transferred to tensor with paddle tensor_array_to_tensor op.
+// The elements in it should be concatenated along an axis.
// We only support concat along axis 0 for now. paddle.concat always along axis 0.
// what's more, we only support the pattern of "TensorArrayLength<->TensorArrayWrite" for now, which
-// is tranformed togther. That means, tensorarray are always appended at the end.
+// is transformed together. That means, tensorarray are always appended at the end.
NamedOutputs tensor_array_to_tensor(const NodeContext& node) {
using namespace default_opset;
const auto x = node.get_input("X");
diff --git a/src/frontends/paddle/src/op/yolo_box.cpp b/src/frontends/paddle/src/op/yolo_box.cpp
index 5e0bb03968e..597aca6b86e 100644
--- a/src/frontends/paddle/src/op/yolo_box.cpp
+++ b/src/frontends/paddle/src/op/yolo_box.cpp
@@ -37,7 +37,7 @@ NamedOutputs yolo_box(const NodeContext& node_context) {
auto const_class_num = Constant::create<int64_t>(i64, {1}, {class_num});
// Paddle anchors attribute is of type int32. Convert to float for computing
- // convinient.
+ // convenient.
auto _anchors = node_context.get_attribute<std::vector<int32_t>>("anchors");
std::vector<float> anchors(_anchors.size());
diff --git a/src/frontends/paddle/tests/common.cmake b/src/frontends/paddle/tests/common.cmake
index 70fda2fcb17..86832a9c1c7 100644
--- a/src/frontends/paddle/tests/common.cmake
+++ b/src/frontends/paddle/tests/common.cmake
@@ -66,7 +66,7 @@ if(paddlepaddle_FOUND)
DownloadAndCheck(${PADDLEDET_OPS_URL} ${PADDLEDET_DIRNAME}/ops.py PADDLEDET_FATAL PADDLEDET_RESULT ${PADDLEDET_OPS_SHA256})
else()
- set(paddle_gen_tag "unkown")
+ set(paddle_gen_tag "unknown")
endif()
diff --git a/src/frontends/paddle/tests/op_fuzzy.cpp b/src/frontends/paddle/tests/op_fuzzy.cpp
index 67bc83cff7a..bc3cc1b3be8 100644
--- a/src/frontends/paddle/tests/op_fuzzy.cpp
+++ b/src/frontends/paddle/tests/op_fuzzy.cpp
@@ -679,7 +679,7 @@ static const std::vector<std::string> models{
std::string("scatter_test_1/scatter_test_1.pdmodel"),
std::string("scatter_test_2/scatter_test_2.pdmodel"),
std::string("scatter_nd_add_test_1/scatter_nd_add_test_1.pdmodel"),
- // Temporily disable them until root caused to secure CI stable.
+ // Temporarily disable them until root caused to secure CI stable.
// CVS-66703 to track this.
// std::string("yolo_box_clip_box/yolo_box_clip_box.pdmodel"),
// std::string("yolo_box_default/yolo_box_default.pdmodel"),
diff --git a/src/frontends/paddle/tests/test_models/gen_scripts/generate_place_test_model.py b/src/frontends/paddle/tests/test_models/gen_scripts/generate_place_test_model.py
index 4ad5435f0b4..98f6b70326c 100644
--- a/src/frontends/paddle/tests/test_models/gen_scripts/generate_place_test_model.py
+++ b/src/frontends/paddle/tests/test_models/gen_scripts/generate_place_test_model.py
@@ -23,7 +23,7 @@ def paddle_rnn_lstm(input_size, hidden_size, layers, direction):
prev_c = paddle.ones(shape=[layers * num_of_directions, 4, hidden_size], dtype=np.float32, name="const_2")
y, (h, c) = rnn(data, (prev_h, prev_c))
- # in paddle 2.6.2, it alway add a scale in the generated model, but after updated to 3.0.0, the scale is removed,
+ # in paddle 2.6.2, it always add a scale in the generated model, but after updated to 3.0.0, the scale is removed,
output1 = paddle.scale(y, scale=1.0, bias=0.0, bias_after_scale=True, act=None, name=None)
output2 = paddle.scale(h, scale=1.0, bias=0.0, bias_after_scale=True, act=None, name=None)
output3 = paddle.scale(c, scale=1.0, bias=0.0, bias_after_scale=True, act=None, name=None)
diff --git a/src/frontends/paddle/tests/test_models/gen_scripts/generate_slice.py b/src/frontends/paddle/tests/test_models/gen_scripts/generate_slice.py
index 0d68030b6b3..92172bd7d18 100644
--- a/src/frontends/paddle/tests/test_models/gen_scripts/generate_slice.py
+++ b/src/frontends/paddle/tests/test_models/gen_scripts/generate_slice.py
@@ -55,7 +55,7 @@ def slice_dyn(test_shape=[2,8,10,10]):
@paddle.jit.to_static
def test_slice(x):
return paddle.slice(x, axes=[0,1,3], starts=[0,1,5], ends=[1,3,6])
- # exportModel('slice_dyn', test_slice, [data], target_dir=sys.argv[1]) # output shape (1, 2, 10, 1) # disable it by default as this kind of test model already there. It's for comparsion only.
+ # exportModel('slice_dyn', test_slice, [data], target_dir=sys.argv[1]) # output shape (1, 2, 10, 1) # disable it by default as this kind of test model already there. It's for comparison only.
'''
slice w/ decrease_axis of all dims
@@ -71,7 +71,7 @@ def slice_dyn(test_shape=[2,8,10,10]):
@paddle.jit.to_static
def test_slice_alldim(x):
return paddle.slice(x, axes=[0,1,2,3], starts=[0,0,0,0], ends=[1,1,1,1])
- # exportModel('slice_alldim', test_slice_alldim, [data], target_dir=sys.argv[1]) # output shape (1, 1, 1, 1) # disable it by default as this kind of test model already there. It's for comparsion only.
+ # exportModel('slice_alldim', test_slice_alldim, [data], target_dir=sys.argv[1]) # output shape (1, 1, 1, 1) # disable it by default as this kind of test model already there. It's for comparison only.
'''
a test case simulating the last reshape2 of ocrnet which accepts slice (with decrease_axes in all dims) as its parents.
diff --git a/src/frontends/paddle/tests/test_models/gen_scripts/nms.py b/src/frontends/paddle/tests/test_models/gen_scripts/nms.py
index 01a17238be6..e8fdfc42c03 100644
--- a/src/frontends/paddle/tests/test_models/gen_scripts/nms.py
+++ b/src/frontends/paddle/tests/test_models/gen_scripts/nms.py
@@ -44,7 +44,7 @@ def NMS(name: str, bboxes, scores, attrs: dict, rois_num=None, verbose=False):
dtype=rois_num.dtype,
lod_level=1)
- if attrs['nms_type'] is 'multiclass_nms3':
+ if attrs['nms_type'] == 'multiclass_nms3':
nms_outputs = multiclass_nms(bboxes=node_boxes,
scores=node_scores,
background_label=attrs['background_label'],
@@ -109,7 +109,7 @@ def NMS(name: str, bboxes, scores, attrs: dict, rois_num=None, verbose=False):
feed_vars = [node_boxes, node_scores]
if node_rois_num is not None:
feed_vars.append(node_rois_num)
- # Save inputs in order of OpenVINO model, to facilite Fuzzy test,
+ # Save inputs in order of OpenVINO model, to facilitate Fuzzy test,
# which accepts inputs and outputs in this order as well.
output_np = [out, nms_rois_num, index]
saveModel(name,
@@ -123,16 +123,16 @@ def NMS(name: str, bboxes, scores, attrs: dict, rois_num=None, verbose=False):
if verbose:
# input
print('\033[94m' + 'bboxes: {}'.format(bboxes.shape) + '\033[0m')
- print_alike(bboxes, seperator_begin='', seperator_end='', verbose=True)
+ print_alike(bboxes, separator_begin='', separator_end='', verbose=True)
print('\033[94m' + 'scores: {}'.format(scores.shape) + '\033[0m')
- print_alike(scores, seperator_begin='', seperator_end='', verbose=True)
+ print_alike(scores, separator_begin='', separator_end='', verbose=True)
# output
print('\033[91m' + 'out_np: {}'.format(out.shape) + '\033[0m')
- print_alike(out, seperator_begin='', seperator_end='', verbose=True)
+ print_alike(out, separator_begin='', separator_end='', verbose=True)
print('\033[91m' + 'nms_rois_num_np: {}'.format(nms_rois_num.shape) +
'\033[0m')
- print_alike(nms_rois_num, seperator_begin='', seperator_end='', verbose=True)
+ print_alike(nms_rois_num, separator_begin='', separator_end='', verbose=True)
if index is not None:
print('\033[91m' + 'index_np: {}'.format(index.shape) + '\033[0m')
- print_alike(index, seperator_begin='', seperator_end='', verbose=True)
+ print_alike(index, separator_begin='', separator_end='', verbose=True)
diff --git a/src/frontends/paddle/tests/test_models/gen_scripts/save_model.py b/src/frontends/paddle/tests/test_models/gen_scripts/save_model.py
index 5f0893abc1b..a544ea5f0fe 100644
--- a/src/frontends/paddle/tests/test_models/gen_scripts/save_model.py
+++ b/src/frontends/paddle/tests/test_models/gen_scripts/save_model.py
@@ -7,7 +7,7 @@ import numpy as np
import paddle
#print numpy array like C structure
-def print_alike(arr, seperator_begin='{', seperator_end='}', verbose=False):
+def print_alike(arr, separator_begin='{', separator_end='}', verbose=False):
shape = arr.shape
rank = len(shape)
@@ -20,16 +20,16 @@ def print_alike(arr, seperator_begin='{', seperator_end='}', verbose=False):
shape = arr.shape
rank = len(arr.shape)
if rank > 1:
- line = seperator_begin
+ line = separator_begin
for i in range(arr.shape[0]):
line += print_array(
arr[i, :],
- end=seperator_end +
- ",\n" if i < arr.shape[0] - 1 else seperator_end)
+ end=separator_end +
+ ",\n" if i < arr.shape[0] - 1 else separator_end)
line += end
return line
else:
- line = seperator_begin
+ line = separator_begin
for i in range(arr.shape[0]):
line += "{:.2f}".format(arr[i]) # str(arr[i])
line += ", " if i < shape[0] - 1 else ' '
@@ -38,7 +38,7 @@ def print_alike(arr, seperator_begin='{', seperator_end='}', verbose=False):
return line
if verbose:
- print(print_array(arr, seperator_end))
+ print(print_array(arr, separator_end))
def saveModel(name, exe, feed_vars:list, fetchlist:list, inputs:list, outputs:list, target_dir:str):
model_dir = os.path.join(target_dir, name)
diff --git a/src/frontends/pytorch/include/openvino/frontend/pytorch/decoder.hpp b/src/frontends/pytorch/include/openvino/frontend/pytorch/decoder.hpp
index a7c360b1f31..7f2b53f6b6a 100644
--- a/src/frontends/pytorch/include/openvino/frontend/pytorch/decoder.hpp
+++ b/src/frontends/pytorch/include/openvino/frontend/pytorch/decoder.hpp
@@ -43,23 +43,23 @@ public:
// Return signature name of the input tensor
virtual const std::string& get_input_signature_name(size_t index) const = 0;
- // Return shape if inputs has torch::Tensor type in the original model, otherwise returns the shape [] of a scalar
+ // Return shape if input has torch::Tensor type in the original model, otherwise returns the shape [] of a scalar
virtual PartialShape get_input_shape(size_t index) const = 0;
- // Return strides if inputs has torch::Tensor type in original model, otherwise return [].
+ // Return strides if input has torch::Tensor type in original model, otherwise return [].
virtual const std::vector<size_t>& get_input_strides(size_t index) const = 0;
- // Return element::Type when it the original type can be represented, otherwise returns PT-specific data type object
+ // Return element::Type when the original type can be represented, otherwise returns PT-specific data type object
// (see custom_type.hpp)
virtual Any get_input_type(size_t index) const = 0;
- // Return debug name of the input tensor
+ // Return debug name of the output tensor
virtual const std::string& get_output_debug_name(size_t index) const = 0;
- // Return shape if inputs has torch::Tensor type in the original model, otherwise returns the shape [] of a scalar
+ // Return shape if output has torch::Tensor type in the original model, otherwise returns the shape [] of a scalar
virtual PartialShape get_output_shape(size_t index) const = 0;
- // Return element::Type when it the original type can be represented, otherwise returns PT-specific data type object
+ // Return element::Type when the original type can be represented, otherwise returns PT-specific data type object
// (see custom_type.hpp)
virtual Any get_output_type(size_t index) const = 0;
// ------------------------------
@@ -69,12 +69,12 @@ public:
virtual OutputVector try_decode_get_attr() const = 0;
- // Work for natural constant nodes, e.g. for prim::Constant; don't know other nodes kinds that fit
+ // Works for natural constant nodes, e.g. for prim::Constant; don't know other nodes kinds that fit
// TODO: why OutputVector instead of just single output?
virtual OutputVector as_constant() const = 0;
- // Get string from constant. Work for natural constant nodes, e.g. for prim::Constant; don't know other nodes kinds
- // that fit
+ // Get string from constant. Works for natural constant nodes, e.g. for prim::Constant; don't know other nodes
+ // kinds that fit
virtual const std::string& as_string() const = 0;
// Returns PT node kind as a string mnemonics for native type uint32_t Symbol in Torch
diff --git a/src/frontends/pytorch/include/openvino/frontend/pytorch/frontend.hpp b/src/frontends/pytorch/include/openvino/frontend/pytorch/frontend.hpp
index b9071ec54bc..d1659969a2e 100644
--- a/src/frontends/pytorch/include/openvino/frontend/pytorch/frontend.hpp
+++ b/src/frontends/pytorch/include/openvino/frontend/pytorch/frontend.hpp
@@ -49,7 +49,7 @@ public:
/// \brief Gets name of this FrontEnd. Can be used by clients
/// if frontend is selected automatically by FrontEndManager::load_by_model
- /// \return Paddle frontend name.
+ /// \return PyTorch frontend name.
std::string get_name() const override {
return "pytorch";
}
diff --git a/src/frontends/pytorch/src/frontend.cpp b/src/frontends/pytorch/src/frontend.cpp
index a2dd3ef79ba..49d669966e0 100644
--- a/src/frontends/pytorch/src/frontend.cpp
+++ b/src/frontends/pytorch/src/frontend.cpp
@@ -280,7 +280,7 @@ void FrontEnd::normalize(const std::shared_ptr<ov::Model>& model) const {
manager.register_pass<ov::frontend::pytorch::pass::AtenIndexToSelect>();
// Mark low precision compressed constants to prevent CF for them,
- // so that not extra memory is used for intermediate decompressed constants.
+ // so that no extra memory is used for intermediate decompressed constants.
manager.register_pass<ov::pass::MarkCompressedFloatConstants>();
manager.register_pass<ov::pass::ConvertConvertPromoteTypes>();
diff --git a/src/frontends/pytorch/src/input_model.cpp b/src/frontends/pytorch/src/input_model.cpp
index e21229707e8..ce2e63230bf 100644
--- a/src/frontends/pytorch/src/input_model.cpp
+++ b/src/frontends/pytorch/src/input_model.cpp
@@ -157,7 +157,7 @@ void InputModel::override_all_outputs(const std::vector<Place::Ptr>& outputs) {
return p->is_output();
});
FRONT_END_GENERAL_CHECK(all_outputs, "Only initial outputs are supported by override_all_inputs.");
- // Number of outputs can be lower then in original model
+ // Number of outputs can be lower than in original model
m_outputs = outputs;
}
diff --git a/src/frontends/pytorch/src/node_context.cpp b/src/frontends/pytorch/src/node_context.cpp
index 284efea0785..5e5b9016faa 100644
--- a/src/frontends/pytorch/src/node_context.cpp
+++ b/src/frontends/pytorch/src/node_context.cpp
@@ -114,11 +114,11 @@ Output<Node> NodeContext::get_tensor_from_model_or_create_input(size_t index) co
}
Output<Node> NodeContext::get_input_from_visible_context(size_t index) const {
- FRONT_END_GENERAL_CHECK(index < get_input_size(), "Index ", index, " is lower then number of inputs.");
+ FRONT_END_GENERAL_CHECK(index < get_input_size(), "Index ", index, " is lower than number of inputs.");
auto input_tensor = get_input(static_cast<int>(index));
auto input_node = input_tensor.get_node_shared_ptr();
if (ov::as_type_ptr<v0::Parameter>(input_node)) {
- // We need to look into external context for inputs that would be feed into this parameter
+ // We need to look into external context for inputs that would be fed into this parameter
size_t tensor_idx = m_translate_session->decode_tensor_name(input_node->output(0));
if (m_ext_tensor_map.count(tensor_idx)) {
input_tensor = m_ext_tensor_map.at(tensor_idx);
@@ -366,6 +366,10 @@ Any NodeContext::get_values_from_const_input(int index) const {
return get_constant_data<int16_t>(constant);
case element::u16:
return get_constant_data<uint16_t>(constant);
+ case element::f16:
+ return get_constant_data<ov::float16>(constant);
+ case element::bf16:
+ return get_constant_data<ov::bfloat16>(constant);
case element::boolean:
return get_constant_data<bool>(constant);
default:
diff --git a/src/frontends/pytorch/src/op/adaptive_poolnd.cpp b/src/frontends/pytorch/src/op/adaptive_poolnd.cpp
index 574162e6b4f..6077032a3be 100644
--- a/src/frontends/pytorch/src/op/adaptive_poolnd.cpp
+++ b/src/frontends/pytorch/src/op/adaptive_poolnd.cpp
@@ -100,7 +100,7 @@ OutputVector translate_adaptive_max_pool_base(const NodeContext& context,
pooled_indices = context.mark_node(std::make_shared<v0::Convert>(pooled_indices, element::i64));
pooled_tensor = context.mark_node(std::make_shared<v1::Reshape>(pooled_tensor, output_shape, false));
pooled_indices = context.mark_node(std::make_shared<v1::Reshape>(pooled_indices, output_shape, false));
- // aten::adaptive_max_pool{n}d always returns tuple with 2 tensors: pooled tensor and indicies
+ // aten::adaptive_max_pool{n}d always returns tuple with 2 tensors: pooled tensor and indices
// output selecting only first or preserve both made outside of operation by return_indices flag
return {std::move(pooled_tensor), std::move(pooled_indices)};
};
diff --git a/src/frontends/pytorch/src/op/addmm.cpp b/src/frontends/pytorch/src/op/addmm.cpp
index 072057c4027..096b3a5e23c 100644
--- a/src/frontends/pytorch/src/op/addmm.cpp
+++ b/src/frontends/pytorch/src/op/addmm.cpp
@@ -46,7 +46,7 @@ OutputVector translate_addmm(const NodeContext& context) {
if (!context.input_is_none(4)) {
alpha = context.get_input(4);
}
- return {translate_addmm_common(context, std::move(beta), std::move(alpha))};
+ return translate_addmm_common(context, std::move(beta), std::move(alpha));
};
OutputVector translate_addmm_fx(const NodeContext& context) {
@@ -60,7 +60,7 @@ OutputVector translate_addmm_fx(const NodeContext& context) {
if (context.has_attribute("alpha")) {
alpha = context.get_input("alpha");
}
- return {translate_addmm_common(context, std::move(beta), std::move(alpha))};
+ return translate_addmm_common(context, std::move(beta), std::move(alpha));
};
OutputVector translate_conv1d_ext(const NodeContext& context) {
diff --git a/src/frontends/pytorch/src/op/distance.cpp b/src/frontends/pytorch/src/op/distance.cpp
index 2026dfdefb1..13bff14fa56 100644
--- a/src/frontends/pytorch/src/op/distance.cpp
+++ b/src/frontends/pytorch/src/op/distance.cpp
@@ -44,7 +44,7 @@ Output<Node> pairwise_distance(const NodeContext& context,
OutputVector translate_cdist(const NodeContext& context) {
// aten::cdist(Tensor x1, Tensor x2, float p=2., int? compute_mode=None) -> Tensor
- // compute_mode can be ignored as we will always use matrix multiplication for euclidian distance computation
+ // compute_mode can be ignored as we will always use matrix multiplication for euclidean distance computation
num_inputs_check(context, 2, 4);
auto x = context.get_input(0);
auto y = context.get_input(1);
diff --git a/src/frontends/pytorch/src/op/index_add.cpp b/src/frontends/pytorch/src/op/index_add.cpp
index b55c02eabb4..4cd5d96f8fe 100644
--- a/src/frontends/pytorch/src/op/index_add.cpp
+++ b/src/frontends/pytorch/src/op/index_add.cpp
@@ -67,13 +67,13 @@ OutputVector translate_index_add(const NodeContext& context) {
auto src_ =
context.mark_node(std::make_shared<v3::Broadcast>(src_broadcasted, new_shape, BroadcastType::BIDIRECTIONAL));
auto src_input_dtype = context.mark_node(std::make_shared<v1::ConvertLike>(src_, input));
- // brodcast index to input rank size
+ // broadcast index to input rank size
src_rank = context.mark_node(std::make_shared<v3::ShapeOf>(new_shape, element::i32));
auto new_index_shape = context.mark_node(std::make_shared<v3::Broadcast>(const_one, src_rank));
auto const_minus_one = context.mark_node(v0::Constant::create(element::i32, Shape{1}, {-1}));
new_index_shape = context.mark_node(
std::make_shared<v12::ScatterElementsUpdate>(new_index_shape, dim_1d, const_minus_one, const_zero));
- // precerve indicies location for spicifc dim
+ // preserve indices location for specific dim
auto reshaped_index = context.mark_node(std::make_shared<v1::Reshape>(index, new_index_shape, false));
auto broadcasted_index =
context.mark_node(std::make_shared<v3::Broadcast>(reshaped_index, new_shape, BroadcastType::BIDIRECTIONAL));
diff --git a/src/frontends/pytorch/src/op/index_select.cpp b/src/frontends/pytorch/src/op/index_select.cpp
index ee1f2ac4157..41c9a9983bc 100644
--- a/src/frontends/pytorch/src/op/index_select.cpp
+++ b/src/frontends/pytorch/src/op/index_select.cpp
@@ -17,8 +17,8 @@ OutputVector translate_index_select(const NodeContext& context) {
num_inputs_check(context, 3, 4);
auto x = context.get_input(0);
auto dim = context.get_input(1);
- auto indicies = context.get_input(2);
- auto gather = context.mark_node(std::make_shared<ov::op::v8::Gather>(x, indicies, dim));
+ auto indices = context.get_input(2);
+ auto gather = context.mark_node(std::make_shared<ov::op::v8::Gather>(x, indices, dim));
if (!context.input_is_none(3)) {
context.mutate_input(3, gather);
}
diff --git a/src/frontends/pytorch/src/op/is_nonzero.cpp b/src/frontends/pytorch/src/op/is_nonzero.cpp
index 03aa966f93e..289c82bed71 100644
--- a/src/frontends/pytorch/src/op/is_nonzero.cpp
+++ b/src/frontends/pytorch/src/op/is_nonzero.cpp
@@ -6,7 +6,7 @@
#include "openvino/op/constant.hpp"
#include "openvino/op/convert_like.hpp"
#include "openvino/op/not_equal.hpp"
-#include "pt_framework_node.hpp"
+#include "openvino/op/reshape.hpp"
#include "utils.hpp"
namespace ov {
@@ -20,10 +20,12 @@ OutputVector translate_is_nonzero(const NodeContext& context) {
num_inputs_check(context, 1, 1);
auto input = context.get_input(0);
- auto zero_tensor = context.mark_node(v0::Constant::create(element::boolean, Shape{1}, {false}));
-
- zero_tensor = context.mark_node(std::make_shared<v1::ConvertLike>(zero_tensor, input));
- auto result = context.mark_node(std::make_shared<v1::NotEqual>(input, zero_tensor));
+ // aten::is_nonzero expects numel == 1; reshape to 0D scalar and compare to zero.
+ auto scalar_shape = context.mark_node(v0::Constant::create(element::i32, Shape{0}, {}));
+ auto scalar_input = context.mark_node(std::make_shared<v1::Reshape>(input, scalar_shape, true))->output(0);
+ auto zero_tensor = context.mark_node(v0::Constant::create(element::i32, Shape{}, {0}));
+ zero_tensor = context.mark_node(std::make_shared<v1::ConvertLike>(zero_tensor, scalar_input));
+ auto result = context.mark_node(std::make_shared<v1::NotEqual>(scalar_input, zero_tensor));
return {result};
};
diff --git a/src/frontends/pytorch/src/op/istft.cpp b/src/frontends/pytorch/src/op/istft.cpp
index 76cfabae7f9..1d5bc98e146 100644
--- a/src/frontends/pytorch/src/op/istft.cpp
+++ b/src/frontends/pytorch/src/op/istft.cpp
@@ -37,7 +37,7 @@ OutputVector translate_istft(const NodeContext& context) {
if (!context.input_is_none(2)) {
hop_length = context.get_input(2);
} else {
- // Defualt floor(n_fft / 4)
+ // Default floor(n_fft / 4)
const auto four = context.mark_node(std::make_shared<ov::op::v0::Constant>(ov::element::i32, Shape{}, 4));
const auto four_cast = context.mark_node(std::make_shared<ov::op::v1::ConvertLike>(four, n_fft));
hop_length = context.mark_node(std::make_shared<ov::op::v1::Divide>(n_fft, four_cast));
diff --git a/src/frontends/pytorch/src/op/linspace.cpp b/src/frontends/pytorch/src/op/linspace.cpp
index 27e98606911..bddef29d610 100644
--- a/src/frontends/pytorch/src/op/linspace.cpp
+++ b/src/frontends/pytorch/src/op/linspace.cpp
@@ -57,9 +57,10 @@ OutputVector translate_linspace(const NodeContext& context) {
auto step_range = context.mark_node(std::make_shared<v4::Range>(const_0, steps, const_1, element::f32));
auto sub_end_start = context.mark_node(std::make_shared<v1::Subtract>(end, start));
- auto sub_steps_1 = context.mark_node(std::make_shared<v1::Subtract>(steps, const_1));
- auto step_multiplier = context.mark_node(std::make_shared<v1::Divide>(sub_end_start, sub_steps_1));
auto is_single_step = context.mark_node(std::make_shared<v1::Equal>(steps, const_1));
+ auto sub_steps_1 = context.mark_node(std::make_shared<v1::Subtract>(steps, const_1));
+ auto safe_steps = context.mark_node(std::make_shared<v1::Select>(is_single_step, const_1, sub_steps_1));
+ auto step_multiplier = context.mark_node(std::make_shared<v1::Divide>(sub_end_start, safe_steps));
auto select_multiplier = context.mark_node(std::make_shared<v1::Select>(is_single_step, const_0, step_multiplier));
auto step_values = context.mark_node(std::make_shared<v1::Multiply>(step_range, select_multiplier));
diff --git a/src/frontends/pytorch/src/op/loop.cpp b/src/frontends/pytorch/src/op/loop.cpp
index 0113d805a03..992d8ecc2aa 100644
--- a/src/frontends/pytorch/src/op/loop.cpp
+++ b/src/frontends/pytorch/src/op/loop.cpp
@@ -42,7 +42,7 @@ OutputVector translate_loop(const NodeContext& context) {
auto result = body_results[i];
auto out_idx = session->decode_tensor_name(result->input(0).get_source_output());
PYTORCH_OP_CONVERSION_CHECK(output_idxs.count(out_idx) == 0,
- "More then one body output with same tensor name.");
+ "More than one body output with same tensor name.");
output_idxs[out_idx] = result;
}
diff --git a/src/frontends/pytorch/src/op/masked_scatter.cpp b/src/frontends/pytorch/src/op/masked_scatter.cpp
index afdbc83f73e..a274d528c54 100644
--- a/src/frontends/pytorch/src/op/masked_scatter.cpp
+++ b/src/frontends/pytorch/src/op/masked_scatter.cpp
@@ -37,7 +37,7 @@ OutputVector translate_masked_scatter(const NodeContext& context) {
auto index = context.mark_node(std::make_shared<v3::NonZero>(expanded_mask));
auto input_order = context.mark_node(v0::Constant::create(element::i32, Shape{2}, {1, 0}));
index = context.mark_node(std::make_shared<v1::Transpose>(index, input_order));
- // source can be arbitary shape, select only relevant data
+ // source can be arbitrary shape, select only relevant data
auto const_minus_one = context.mark_node(v0::Constant::create(element::i32, Shape{1}, {-1}));
auto flatten_source = context.mark_node(std::make_shared<v1::Reshape>(source, const_minus_one, false));
auto const_zero = context.mark_node(v0::Constant::create(element::i32, Shape{1}, {0}));
diff --git a/src/frontends/pytorch/src/op/multinomial.cpp b/src/frontends/pytorch/src/op/multinomial.cpp
index 98b872903b6..e45c19dad58 100644
--- a/src/frontends/pytorch/src/op/multinomial.cpp
+++ b/src/frontends/pytorch/src/op/multinomial.cpp
@@ -44,8 +44,8 @@ OutputVector translate_multinomial(const NodeContext& context) {
std::make_shared<v12::ScatterElementsUpdate>(input_shape, const_neg_1, num_samples, const_neg_1));
multinomial = context.mark_node(std::make_shared<v1::Reshape>(multinomial, out_shape, false));
- if (!context.input_is_none(5)) {
- context.mutate_input(5, multinomial);
+ if (!context.input_is_none(4)) {
+ context.mutate_input(4, multinomial);
}
return {multinomial};
};
diff --git a/src/frontends/pytorch/src/op/repeat_interleave.cpp b/src/frontends/pytorch/src/op/repeat_interleave.cpp
index eb5aa1d16aa..fe954cf512e 100644
--- a/src/frontends/pytorch/src/op/repeat_interleave.cpp
+++ b/src/frontends/pytorch/src/op/repeat_interleave.cpp
@@ -57,7 +57,7 @@ OutputVector translate_repeat_interleave(const NodeContext& context) {
auto repeats_ext = context.get_input_from_visible_context(1);
auto repeats_const = ov::as_type_ptr<v0::Constant>(repeats_ext.get_node_shared_ptr());
if (repeats_const && repeats_const->cast_vector<int32_t>().size() > 1) {
- // repeats is Constant with more then 1 element
+ // repeats is Constant with more than 1 element
auto repeats = repeats_const->cast_vector<int32_t>();
if (context.input_is_none(2)) {
// case (repeats=tensor, dim=None)
diff --git a/src/frontends/pytorch/src/op/scaled_dot_product_attention.cpp b/src/frontends/pytorch/src/op/scaled_dot_product_attention.cpp
index 96c22629f18..2a09c1c2ead 100644
--- a/src/frontends/pytorch/src/op/scaled_dot_product_attention.cpp
+++ b/src/frontends/pytorch/src/op/scaled_dot_product_attention.cpp
@@ -206,7 +206,7 @@ OutputVector translate_scaled_dot_product_attention_fx(const NodeContext& contex
// Index 3 is dropout
auto causal = false;
if (context.has_attribute("is_causal")) {
- causal = context.get_attribute<bool>("scale");
+ causal = context.get_attribute<bool>("is_causal");
} else if (!context.input_is_none(4)) {
causal = context.const_input<bool>(4);
}
diff --git a/src/frontends/pytorch/src/op/stft.cpp b/src/frontends/pytorch/src/op/stft.cpp
index 512a2f5ea26..94deb298655 100644
--- a/src/frontends/pytorch/src/op/stft.cpp
+++ b/src/frontends/pytorch/src/op/stft.cpp
@@ -38,7 +38,7 @@ OutputVector translate_stft(const NodeContext& context) {
if (!context.input_is_none(2)) {
hop_length = context.get_input(2);
} else {
- // Defualt floor(n_fft / 4)
+ // Default floor(n_fft / 4)
const auto four = context.mark_node(std::make_shared<ov::op::v0::Constant>(ov::element::i32, Shape{}, 4));
const auto four_cast = context.mark_node(std::make_shared<ov::op::v1::ConvertLike>(four, n_fft));
hop_length = context.mark_node(std::make_shared<ov::op::v1::Divide>(n_fft, four_cast));
diff --git a/src/frontends/pytorch/src/op/to.cpp b/src/frontends/pytorch/src/op/to.cpp
index 92d5be2d315..5b26d2acd95 100644
--- a/src/frontends/pytorch/src/op/to.cpp
+++ b/src/frontends/pytorch/src/op/to.cpp
@@ -65,7 +65,7 @@ OutputVector translate_to(const NodeContext& context) {
// stages. (e.g. transformations passes)
// memory_format sets the desired memory format of returned Tensor.
- // memory format is ignored since it changes strides of a tensor. In openvino tensors are always contigious
+ // memory format is ignored since it changes strides of a tensor. In openvino tensors are always contiguous
auto dtype_ext_node = context.get_input_from_visible_context(dtype_idx).get_node_shared_ptr();
auto dtype_fw_node = ov::as_type_ptr<PtFrameworkNode>(dtype_ext_node);
auto data = context.get_input(0);
diff --git a/src/frontends/pytorch/src/place.cpp b/src/frontends/pytorch/src/place.cpp
index 7f06f679f46..6e087eb8405 100644
--- a/src/frontends/pytorch/src/place.cpp
+++ b/src/frontends/pytorch/src/place.cpp
@@ -52,7 +52,7 @@ Place::Place(const ov::frontend::InputModel& input_model, size_t tensor_index)
}
}
if (m_is_input && m_is_output) {
- OPENVINO_DEBUG("[WARNING] Place ", tensor_index, " is input and output at a same time.");
+ OPENVINO_DEBUG("[WARNING] Place ", tensor_index, " is input and output at the same time.");
}
}
diff --git a/src/frontends/pytorch/src/transforms/append_list_unpack_replacer.cpp b/src/frontends/pytorch/src/transforms/append_list_unpack_replacer.cpp
index 248554128da..d46445520ac 100644
--- a/src/frontends/pytorch/src/transforms/append_list_unpack_replacer.cpp
+++ b/src/frontends/pytorch/src/transforms/append_list_unpack_replacer.cpp
@@ -64,7 +64,7 @@ AppendListUnpackReplacer::AppendListUnpackReplacer() {
std::make_move_iterator(tmp_inputs.rend()));
if (getitem_node) {
// If aten::__getitem__, expect inputs to be equivalent of pytorch Tensor[][].
- // Tensor selected by aten::__getitem__ index needs to be splitted in axis 0.
+ // Tensor selected by aten::__getitem__ index needs to be split along axis 0.
auto getitem_index_const = ov::util::get_constant_from_source(getitem_node->input_value(1));
if (!getitem_index_const)
return false;
@@ -90,7 +90,7 @@ AppendListUnpackReplacer::AppendListUnpackReplacer() {
replace_node(list_unpack, res);
return true;
} else {
- // Without aten::__getitem__, expect inputs to be equivalent od pytorch Tensor[].
+ // Without aten::__getitem__, expect inputs to be equivalent of pytorch Tensor[].
// Return all inputs.
replace_node(list_unpack, inputs);
return true;
diff --git a/src/frontends/pytorch/src/transforms/aten_index_replacer.cpp b/src/frontends/pytorch/src/transforms/aten_index_replacer.cpp
index 74fced59d00..58626f75cc5 100644
--- a/src/frontends/pytorch/src/transforms/aten_index_replacer.cpp
+++ b/src/frontends/pytorch/src/transforms/aten_index_replacer.cpp
@@ -42,10 +42,10 @@ AtenIndexToSelect::AtenIndexToSelect() {
auto index_op = m.get_match_root();
ov::pass::NodeRegistry rg;
auto input_node = index_op->input_value(0);
- auto indicies = index_op->input_value(1).get_node_shared_ptr();
- auto list_indicies = cast_fw_node(indicies, "prim::ListConstruct");
- if (list_indicies) {
- auto ids = list_indicies->input_values();
+ auto indices = index_op->input_value(1).get_node_shared_ptr();
+ auto list_indices = cast_fw_node(indices, "prim::ListConstruct");
+ if (list_indices) {
+ auto ids = list_indices->input_values();
auto rank = input_node.get_partial_shape().rank();
// index transformation supports only tensors with static rank
ov::Output<ov::Node> new_output;
@@ -62,7 +62,7 @@ AtenIndexToSelect::AtenIndexToSelect() {
replace_node(index_op, new_output.get_node_shared_ptr());
return true;
} else {
- auto const_input = cast_fw_node(indicies, "prim::Constant");
+ auto const_input = cast_fw_node(indices, "prim::Constant");
if (const_input) {
// index is None, stay input as is
@@ -72,9 +72,9 @@ AtenIndexToSelect::AtenIndexToSelect() {
return true;
}
}
- auto index_dtype = indicies->get_output_element_type(0);
+ auto index_dtype = indices->get_output_element_type(0);
if (index_dtype == element::boolean || index_dtype == element::u8) {
- auto nonzero = rg.make<v3::NonZero>(indicies);
+ auto nonzero = rg.make<v3::NonZero>(indices);
auto input_order = v0::Constant::create(element::i32, Shape{2}, {1, 0});
auto masked_id = rg.make<v1::Transpose>(nonzero, input_order);
auto gather = rg.make<v8::GatherND>(input_node, masked_id);
@@ -83,10 +83,10 @@ AtenIndexToSelect::AtenIndexToSelect() {
return true;
}
if (index_dtype != element::i32) {
- indicies = rg.make<ov::op::v0::Convert>(indicies, element::i32);
+ indices = rg.make<ov::op::v0::Convert>(indices, element::i32);
}
auto dim = v0::Constant::create(element::i32, Shape{}, {0});
- auto gather = rg.make<v8::Gather>(input_node, indicies, dim);
+ auto gather = rg.make<v8::Gather>(input_node, indices, dim);
copy_runtime_info_and_name(index_op, rg.get());
replace_node(index_op, gather);
return true;
diff --git a/src/frontends/pytorch/src/transforms/index_loop_getitem_replacer.cpp b/src/frontends/pytorch/src/transforms/index_loop_getitem_replacer.cpp
index 3a7b3bf7722..fc41b8b807e 100644
--- a/src/frontends/pytorch/src/transforms/index_loop_getitem_replacer.cpp
+++ b/src/frontends/pytorch/src/transforms/index_loop_getitem_replacer.cpp
@@ -77,7 +77,7 @@ IndexLoopGetitemReplacer::IndexLoopGetitemReplacer() {
auto param_targets = chunk_param->get_output_target_inputs(0);
if (param_targets.size() != 1) {
- add_exception_to_fw_node(chunk_op, "aten::chunk: targets more then one.");
+ add_exception_to_fw_node(chunk_op, "aten::chunk: targets more than one.");
return false;
}
diff --git a/src/frontends/pytorch/src/transforms/listconstruct_replacer.cpp b/src/frontends/pytorch/src/transforms/listconstruct_replacer.cpp
index a56e775509c..6f7931e520f 100644
--- a/src/frontends/pytorch/src/transforms/listconstruct_replacer.cpp
+++ b/src/frontends/pytorch/src/transforms/listconstruct_replacer.cpp
@@ -75,7 +75,7 @@ ListConstructReplacer::ListConstructReplacer() {
auto rank = input.get_partial_shape().rank();
if (rank.is_static() && rank.get_length() > 1) {
// if list elements of rank higher then 1D we cannot resolve it
- add_exception_to_fw_node(list, "unsupported list: all inputs must be 1D.");
+ add_exception_to_fw_node(list_out.get_node_shared_ptr(), "unsupported list: all inputs must be 1D.");
return false;
}
// reshape all elements to 1D
diff --git a/src/frontends/pytorch/src/transforms/prim_list_unpack_replacer.cpp b/src/frontends/pytorch/src/transforms/prim_list_unpack_replacer.cpp
index 0b9f240bdc5..7c8354bf91c 100644
--- a/src/frontends/pytorch/src/transforms/prim_list_unpack_replacer.cpp
+++ b/src/frontends/pytorch/src/transforms/prim_list_unpack_replacer.cpp
@@ -63,12 +63,12 @@ PrimListUnpackReplacer::PrimListUnpackReplacer() {
auto num_out_m_1 =
v0::Constant::create(split_size.get_element_type(), Shape{1}, {list_unpack->get_output_size() - 1});
auto const_neg_1 = v0::Constant::create(split_size.get_element_type(), Shape{1}, {-1});
- auto split_lenghts_m_1 = rg.make<v0::Tile>(split_size, num_out_m_1);
- NodeVector concat_inputs{split_lenghts_m_1, const_neg_1};
- auto split_lenghts = rg.make<v0::Concat>(concat_inputs, 0);
+ auto split_lengths_m_1 = rg.make<v0::Tile>(split_size, num_out_m_1);
+ NodeVector concat_inputs{split_lengths_m_1, const_neg_1};
+ auto split_lengths = rg.make<v0::Concat>(concat_inputs, 0);
split = rg.make<v1::VariadicSplit>(torch_split->get_input_source_output(0),
torch_split->get_input_source_output(2),
- split_lenghts);
+ split_lengths);
} else {
split = rg.make<v1::VariadicSplit>(torch_split->get_input_source_output(0),
torch_split->get_input_source_output(2),
diff --git a/src/frontends/pytorch/src/transforms/tuple_unpack_replacer.cpp b/src/frontends/pytorch/src/transforms/tuple_unpack_replacer.cpp
index b61fb39ec17..4e04846402e 100644
--- a/src/frontends/pytorch/src/transforms/tuple_unpack_replacer.cpp
+++ b/src/frontends/pytorch/src/transforms/tuple_unpack_replacer.cpp
@@ -82,7 +82,7 @@ bool TupleUnpackInBodyReplacer::run_on_model(const std::shared_ptr<Model>& model
if (then_body_idx != -1) {
add_exception_to_fw_node(
tuple_construct,
- "Unexpected: TupleConstruct output is used in body more then once.");
+ "Unexpected: TupleConstruct output is used in body more than once.");
} else {
then_body_idx = static_cast<int>(inp_desc->m_body_parameter_index);
}
@@ -93,7 +93,7 @@ bool TupleUnpackInBodyReplacer::run_on_model(const std::shared_ptr<Model>& model
if (else_body_idx != -1) {
add_exception_to_fw_node(
tuple_construct,
- "Unexpected: TupleConstruct output is used in body more then once.");
+ "Unexpected: TupleConstruct output is used in body more than once.");
} else {
else_body_idx = static_cast<int>(inp_desc->m_body_parameter_index);
}
diff --git a/src/frontends/pytorch/src/transforms/u4_block_repack.cpp b/src/frontends/pytorch/src/transforms/u4_block_repack.cpp
index 0057a7539bd..7c86ef0565d 100644
--- a/src/frontends/pytorch/src/transforms/u4_block_repack.cpp
+++ b/src/frontends/pytorch/src/transforms/u4_block_repack.cpp
@@ -33,7 +33,7 @@ U4BlockRepack::U4BlockRepack(bool is_symmetrical) {
auto pack_byte = [](uint8_t lo, uint8_t hi) -> uint8_t {
return (hi << 4) | (lo & 0x0F);
- }; // swap halfs because Convert op assumes this layout
+ }; // swap halves because Convert op assumes this layout
const std::function<uint8_t(const uint8_t*, size_t)>& get_u4 = [](const uint8_t* src, size_t idx) {
const size_t byte_idx = idx / 2;
diff --git a/src/frontends/pytorch/src/utils.cpp b/src/frontends/pytorch/src/utils.cpp
index aa4b1bc3a2a..89a2b254b7f 100644
--- a/src/frontends/pytorch/src/utils.cpp
+++ b/src/frontends/pytorch/src/utils.cpp
@@ -358,11 +358,11 @@ OutputVector make_framework_node(const NodeContext& context, const std::string&
for (size_t i = num_body_outs; i < body_results.size(); i++) {
auto out_idx = session->decode_tensor_name(body_results[i]->input(0).get_source_output());
FRONT_END_OP_CONVERSION_CHECK(extra_outputs_map.count(out_idx) == 0,
- "More then one body output with same tensor name.");
+ "More than one body output with same tensor name.");
extra_outputs_map[out_idx].push_back(body_results[i]);
}
}
- // Number of body outputs can be higher then number of pt node outputs, e.g. in case of loop first body output is
+ // Number of body outputs can be higher than number of pt node outputs, e.g. in case of loop first body output is
// condition, we have to skip such outputs.
auto num_skip_body_outputs =
num_body_outs > context.get_output_size() ? num_body_outs - context.get_output_size() : 0;
@@ -778,7 +778,7 @@ bool index_tensor_on_list(ov::pass::NodeRegistry& rg,
// After gather, reshape and transpose back.
std::vector<size_t> advanced_ids;
std::vector<bool> is_masked_bool;
- OutputVector masked_indicies;
+ OutputVector masked_indices;
// for case when index is bool e.g. x[x>0], replace index with non_zero
for (size_t i = 0; i < indices.size(); ++i) {
// skip dimensions where index is None
@@ -793,7 +793,7 @@ bool index_tensor_on_list(ov::pass::NodeRegistry& rg,
}
}
if (is_none) {
- masked_indicies.push_back(indices[i]);
+ masked_indices.push_back(indices[i]);
is_masked_bool.push_back(false);
continue;
}
@@ -809,16 +809,16 @@ bool index_tensor_on_list(ov::pass::NodeRegistry& rg,
auto zero_const = rg.make<v0::Constant>(element::i32, Shape{1}, 0);
masked_id = rg.make<v0::Squeeze>(nonzero, zero_const);
}
- masked_indicies.push_back(masked_id);
+ masked_indices.push_back(masked_id);
is_masked_bool.push_back(true);
} else {
- masked_indicies.push_back(indices[i]);
+ masked_indices.push_back(indices[i]);
is_masked_bool.push_back(false);
}
advanced_ids.push_back(i);
}
- // all indicies prim::Constant(None), return input as is
+ // all indices prim::Constant(None), return input as is
if (advanced_ids.size() == 0) {
new_output = data;
use_input_as_output = true;
@@ -826,7 +826,7 @@ bool index_tensor_on_list(ov::pass::NodeRegistry& rg,
}
// perform gather for single element case
if (advanced_ids.size() == 1 && advanced_ids[0] == 0) {
- auto index = masked_indicies[advanced_ids[0]];
+ auto index = masked_indices[advanced_ids[0]];
if (is_masked_bool[advanced_ids[0]]) {
auto gather = rg.make<v8::GatherND>(data, index);
new_output = gather->output(0);
@@ -860,12 +860,12 @@ bool index_tensor_on_list(ov::pass::NodeRegistry& rg,
auto transpose_dims = rg.make<v0::Constant>(element::i32, Shape{permutation_dims.size()}, permutation_dims);
auto transposed_input = rg.make<v1::Transpose>(data, transpose_dims);
auto flatten_input = flatten(rg, transposed_input, adv_idx_count);
- auto cum_adv_index = masked_indicies[advanced_ids[adv_idx_count - 1]];
+ auto cum_adv_index = masked_indices[advanced_ids[adv_idx_count - 1]];
cum_adv_index = rg.make<v0::Convert>(cum_adv_index, element::i32);
auto multiplier = input_dims->output(advanced_ids[adv_idx_count - 1]);
for (int i = static_cast<int>(adv_idx_count) - 2; i > -1; i--) {
auto input_id = advanced_ids[i];
- auto m_idx = rg.make<v0::Convert>(masked_indicies[input_id], element::i32);
+ auto m_idx = rg.make<v0::Convert>(masked_indices[input_id], element::i32);
auto adv_index = rg.make<v1::Multiply>(m_idx, multiplier);
cum_adv_index = rg.make<v1::Add>(cum_adv_index, adv_index);
multiplier = rg.make<v1::Multiply>(multiplier, input_dims->output(input_id));
@@ -897,8 +897,8 @@ bool index_tensor_on_list(ov::pass::NodeRegistry& rg,
adv_idx_permute.push_back(i);
}
// Transpose folded advanced indexed axis to its original location.
- auto permute_indicies = rg.make<v0::Constant>(element::i32, Shape{adv_idx_permute.size()}, adv_idx_permute);
- gather = rg.make<v1::Transpose>(gather, permute_indicies);
+ auto permute_indices = rg.make<v0::Constant>(element::i32, Shape{adv_idx_permute.size()}, adv_idx_permute);
+ gather = rg.make<v1::Transpose>(gather, permute_indices);
// unfold advanced index axes
for (size_t i = 0; i < advanced_ids[0]; i++) {
concat_dims.push_back(input_dims->output(i));
diff --git a/src/frontends/pytorch/src/utils.hpp b/src/frontends/pytorch/src/utils.hpp
index 244adb221ca..c71b10dc7d6 100644
--- a/src/frontends/pytorch/src/utils.hpp
+++ b/src/frontends/pytorch/src/utils.hpp
@@ -29,7 +29,7 @@ const std::string& get_pytorch_prefix();
/// \param COND Condition to check
/// \param ... Additional error message info to be added to the error message via the `<<`
/// stream-insertion operator. Note that the expressions here will be evaluated lazily,
-/// i.e., only if the `cond` evalutes to `false`.
+/// i.e., only if the `cond` evaluates to `false`.
/// \throws ::ov::frontend::OpConversionFailure if `cond` is false.
#ifndef PYTORCH_OP_CONVERSION_CHECK
# define PYTORCH_OP_CONVERSION_CHECK(COND, ...) \
diff --git a/src/frontends/pytorch/src/utils_quantize.cpp b/src/frontends/pytorch/src/utils_quantize.cpp
index bff601f12a7..ff08c67286a 100644
--- a/src/frontends/pytorch/src/utils_quantize.cpp
+++ b/src/frontends/pytorch/src/utils_quantize.cpp
@@ -244,6 +244,9 @@ std::shared_ptr<Node> u4_compression_stack(const OutputVector& list_elems, int64
auto weights_u8 = ov::as_type_ptr<v0::Constant>(bitwise_and->get_input_node_shared_ptr(0));
auto weights_u8_bitwise_shift = ov::as_type_ptr<v0::Constant>(bitwise_shift->get_input_node_shared_ptr(0));
+ if (!weights_u8 || !weights_u8_bitwise_shift)
+ return nullptr;
+
if (weights_u8->get_data_ptr() != weights_u8_bitwise_shift->get_data_ptr())
return nullptr;
diff --git a/src/frontends/tensorflow/include/openvino/frontend/tensorflow/exception.hpp b/src/frontends/tensorflow/include/openvino/frontend/tensorflow/exception.hpp
index 9094fba4173..60ba9278a7c 100644
--- a/src/frontends/tensorflow/include/openvino/frontend/tensorflow/exception.hpp
+++ b/src/frontends/tensorflow/include/openvino/frontend/tensorflow/exception.hpp
@@ -11,7 +11,7 @@ namespace ov {
/// \param cond Condition to check
/// \param ... Additional error message info to be added to the error message via the `<<`
/// stream-insertion operator. Note that the expressions here will be evaluated lazily,
-/// i.e., only if the `cond` evalutes to `false`.
+/// i.e., only if the `cond` evaluates to `false`.
/// \throws ::ov::OpValidationFailure if `cond` is false.
#ifndef TENSORFLOW_OP_VALIDATION
diff --git a/src/frontends/tensorflow/src/checkpoint_utils.hpp b/src/frontends/tensorflow/src/checkpoint_utils.hpp
index 2f274d8770d..29e8ea1f680 100644
--- a/src/frontends/tensorflow/src/checkpoint_utils.hpp
+++ b/src/frontends/tensorflow/src/checkpoint_utils.hpp
@@ -35,7 +35,7 @@ static T smUnpack(char*& ptr, const char* ptr_end) {
return 0;
}
-/// \brief Structure is for storing information about block in Varaibles Index file.
+/// \brief Structure is for storing information about block in Variables Index file.
/// It defines only offset and block size, no information about exact content.
struct VIBlock {
uint64_t m_size;
diff --git a/src/frontends/tensorflow/src/checkpoint_v1_reader.cpp b/src/frontends/tensorflow/src/checkpoint_v1_reader.cpp
index ed1e56f2bdd..d8ac5892f65 100644
--- a/src/frontends/tensorflow/src/checkpoint_v1_reader.cpp
+++ b/src/frontends/tensorflow/src/checkpoint_v1_reader.cpp
@@ -76,15 +76,15 @@ void CheckpointV1Reader::initialize() {
var_info.variable_shape = saved_slice_meta.shape();
var_info.variable_type = saved_slice_meta.type();
- // save starts and lenghts of slices for variable name encoding
+ // save starts and lengths of slices for variable name encoding
for (const auto& slice : saved_slice_meta.slice()) {
// var_info.starts.push_back(slice.extent())
for (const auto& extent : slice.extent()) {
var_info.starts.push_back(extent.start());
if (extent.has_length()) {
- var_info.lenghts.push_back(extent.length());
+ var_info.lengths.push_back(extent.length());
} else {
- var_info.lenghts.push_back(-1);
+ var_info.lengths.push_back(-1);
}
}
}
@@ -244,7 +244,7 @@ void CheckpointV1Reader::read_variable(const std::string& variable_name, ov::Any
"[TensorFlow Frontend] internal error: number of shards does not match a number of their names");
auto shard_ptr = m_shards[shard_id];
auto shard_name = m_shard_names[shard_id];
- auto encoded_name = encode_tensor_name_slice(variable_name, var_info.starts, var_info.lenghts);
+ auto encoded_name = encode_tensor_name_slice(variable_name, var_info.starts, var_info.lengths);
std::string raw_data;
find_entry(shard_ptr, shard_name, encoded_name, raw_data);
diff --git a/src/frontends/tensorflow/src/checkpoint_v1_reader.hpp b/src/frontends/tensorflow/src/checkpoint_v1_reader.hpp
index 32bf5b91fc4..168185ab299 100644
--- a/src/frontends/tensorflow/src/checkpoint_v1_reader.hpp
+++ b/src/frontends/tensorflow/src/checkpoint_v1_reader.hpp
@@ -25,14 +25,14 @@ struct VariableInfo {
::tensorflow::DataType variable_type;
int32_t shard_id;
std::vector<int64_t> starts;
- std::vector<int64_t> lenghts;
+ std::vector<int64_t> lengths;
};
// reads checkpoints of v1 version
// it parses value, shape and type for Variable nodes
class CheckpointV1Reader {
const std::string m_checkpoints;
- // a map from Variable name to its informations
+ // a map from Variable name to its information
std::unordered_map<std::string, VariableInfo> m_variables_info_map;
// a vector of streams for shards, where shard is one checkpoint file
std::vector<std::shared_ptr<std::ifstream>> m_shards;
diff --git a/src/frontends/tensorflow/src/frontend.cpp b/src/frontends/tensorflow/src/frontend.cpp
index d65493a5cc6..ddc72b9bbb7 100644
--- a/src/frontends/tensorflow/src/frontend.cpp
+++ b/src/frontends/tensorflow/src/frontend.cpp
@@ -53,7 +53,7 @@ void update_failures_unsupported_ops(const std::string& op_type,
return;
}
if (fw_node_attrs.find(FrameworkNode::failed_conversion_key) != fw_node_attrs.end()) {
- // save only the first encountered failure that is more improtant for developer
+ // save only the first encountered failure that is more important for developer
// that means the translator is found but the conversion is failed
failures[op_type] = fw_node_attrs.at(FrameworkNode::failed_conversion_key);
} else {
diff --git a/src/frontends/tensorflow/src/graph_iterator_saved_model.hpp b/src/frontends/tensorflow/src/graph_iterator_saved_model.hpp
index b0bea0a4be1..0a2ee5ac1a1 100644
--- a/src/frontends/tensorflow/src/graph_iterator_saved_model.hpp
+++ b/src/frontends/tensorflow/src/graph_iterator_saved_model.hpp
@@ -210,9 +210,9 @@ private:
return true;
}
- /// \brief Splitting tags by using "," delimeter
+ /// \brief Splitting tags by using "," delimiter
/// \param[in] tags String with tags separated by ","
- /// \return Returns vector with splitted tags, no trimming is used. When you pass "tag1, tag2"
+ /// \return Returns vector with split tags, no trimming is used. When you pass "tag1, tag2"
/// you will have a vector ["tag1", " tag2"]. Because TensorFlow saves tags without trimming
std::vector<std::string> split_tags(const std::string tags) const;
}; // GraphIteratorSavedModel
diff --git a/src/frontends/tensorflow/src/input_model.cpp b/src/frontends/tensorflow/src/input_model.cpp
index 6a23b23e4ad..7634e87b5ce 100644
--- a/src/frontends/tensorflow/src/input_model.cpp
+++ b/src/frontends/tensorflow/src/input_model.cpp
@@ -24,8 +24,8 @@ void extract_operation_name_and_port(const std::string& port_name,
std::string& operation_name,
size_t& port_index,
std::string& port_type) {
- constexpr char delimeter[] = ":";
- auto pos = port_name.find(delimeter);
+ constexpr char delimiter[] = ":";
+ auto pos = port_name.find(delimiter);
if (pos == std::string::npos) {
operation_name = port_name;
port_type = "none";
@@ -309,7 +309,7 @@ void InputModel::InputModelTFImpl::load_places() {
ov::PartialShape({}),
ov::element::dynamic,
std::vector<std::string>{output_name + ":0"});
- // TODO: Create tensor places for each ouput port, ticket-129464
+ // TODO: Create tensor places for each output port, ticket-129464
m_default_places[output_name + ":0"] = output_place;
m_outputs.push_back(output_place);
}
diff --git a/src/frontends/tensorflow/src/op/gru_block_cell.cpp b/src/frontends/tensorflow/src/op/gru_block_cell.cpp
index 4fc3e1fbc9b..a2648494e83 100644
--- a/src/frontends/tensorflow/src/op/gru_block_cell.cpp
+++ b/src/frontends/tensorflow/src/op/gru_block_cell.cpp
@@ -85,7 +85,7 @@ OutputVector translate_gru_block_cell_op(const ov::frontend::tensorflow::NodeCon
hidden_size.is_static(),
"[TensorFlow Frontend] internal error: GRUBlockCell is supported only for static hidden size");
- // retrive input_size and hidden_size
+ // retrieve input_size and hidden_size
auto x_shape = std::make_shared<v3::ShapeOf>(x, element::i64);
auto ss_start = std::make_shared<v0::Constant>(element::i64, Shape{1}, 1);
auto ss_end = std::make_shared<v0::Constant>(element::i64, Shape{1}, 2);
diff --git a/src/frontends/tensorflow/src/op/hash_table.cpp b/src/frontends/tensorflow/src/op/hash_table.cpp
index 28464ca294f..0464a74be67 100644
--- a/src/frontends/tensorflow/src/op/hash_table.cpp
+++ b/src/frontends/tensorflow/src/op/hash_table.cpp
@@ -48,7 +48,7 @@ OutputVector translate_hash_table_op(const ov::frontend::tensorflow::NodeContext
auto new_table = make_shared<HashTable>(*hash_table, keys, values);
return {new_table};
} else {
- // update variables states of translation session with new unitialized variable
+ // update variables states of translation session with new uninitialized variable
auto variables_state_map = node.get_variable_state_map();
TENSORFLOW_OP_VALIDATION(node,
variables_state_map,
diff --git a/src/frontends/tensorflow/src/op/iterator.cpp b/src/frontends/tensorflow/src/op/iterator.cpp
index ab6ea7bf8d2..b0f216fbc1c 100644
--- a/src/frontends/tensorflow/src/op/iterator.cpp
+++ b/src/frontends/tensorflow/src/op/iterator.cpp
@@ -35,8 +35,8 @@ OutputVector translate_iterator_get_next_op(const NodeContext& node) {
// Iterator operations are responsible for iterator creation
// and it usually goes to IteratorGetNext so we have to handle
// Iterator->IteratorGetNext sub-graph
- // From IteratorGetNext generates nultiple outputs which we should
- // automatically prune and create Parameter node for each of them
+ // IteratorGetNext generates multiple outputs; auto-prune and create a
+ // Parameter node for each one
default_op_checks(node, 1, {"IteratorGetNext"});
auto node_name = node.get_name();
auto output_types = node.get_attribute<vector<element::Type>>("output_types");
@@ -46,7 +46,7 @@ OutputVector translate_iterator_get_next_op(const NodeContext& node) {
TENSORFLOW_OP_VALIDATION(
node,
output_num == output_shapes.size(),
- "[TensorFlow Frontend] Incorrect input model: lenghts of output_types and output_shapes do not match.");
+ "[TensorFlow Frontend] Incorrect input model: lengths of output_types and output_shapes do not match.");
OutputVector iterator_get_next_outputs;
// perform auto-pruning: create Parameter nodes for each output of IteratorGetNext
diff --git a/src/frontends/tensorflow/src/proto/ov_tensorflow/xla_data.proto b/src/frontends/tensorflow/src/proto/ov_tensorflow/xla_data.proto
index 95695ba78a2..ebbb08d1414 100644
--- a/src/frontends/tensorflow/src/proto/ov_tensorflow/xla_data.proto
+++ b/src/frontends/tensorflow/src/proto/ov_tensorflow/xla_data.proto
@@ -670,7 +670,7 @@ message OpSharding {
// last dimension. (Experimental)
bool replicate_on_last_tile_dim = 6;
// This field is used to track the source of this sharding, usually derived
- // from instructions. Multple metadata may be populated if sharding is
+ // from instructions. Multiple metadata may be populated if sharding is
// combined with other shardings. Metadata are to not be populated when
// type == TUPLE and instead metadata should be set on individual tuple
// elements.
diff --git a/src/frontends/tensorflow/src/tf_utils.cpp b/src/frontends/tensorflow/src/tf_utils.cpp
index 06962c1f4f7..858235605e9 100644
--- a/src/frontends/tensorflow/src/tf_utils.cpp
+++ b/src/frontends/tensorflow/src/tf_utils.cpp
@@ -451,7 +451,7 @@ bool propagate_conditional_flow(const OutputVector& ov_inputs,
}
// compute output control dependencies
- // logically, the next nodes will dependend on outputs and input control dependencies
+ // logically, the next nodes will depend on outputs and input control dependencies
output_control_deps.clear();
if (to_propagate) {
output_control_deps = input_control_deps;
diff --git a/src/frontends/tensorflow/src/transformations/switch_merge_resolve.cpp b/src/frontends/tensorflow/src/transformations/switch_merge_resolve.cpp
index 54f04939645..95e7e66cdd7 100644
--- a/src/frontends/tensorflow/src/transformations/switch_merge_resolve.cpp
+++ b/src/frontends/tensorflow/src/transformations/switch_merge_resolve.cpp
@@ -117,7 +117,7 @@ void insert_result_before_merge(const shared_ptr<Merge>& merge_node,
uint32_t& branch_index,
shared_ptr<v0::Result>& result_output,
shared_ptr<v0::Result>& result_value_index) {
- // check that handled Marge node contains conditional flow marker
+ // check that handled Merge node contains conditional flow marker
auto merge_node_name = merge_node->get_friendly_name();
FRONT_END_GENERAL_CHECK(cf_marker_exists(merge_node),
"[TensorFlow Frontend] internal error: Merge node " + merge_node_name +
@@ -133,7 +133,7 @@ void insert_result_before_merge(const shared_ptr<Merge>& merge_node,
auto eliminated_marker = merge_cf_marker.merge_eliminated_markers.begin()->first;
// check that producer contains the same conditional flow marker
- // and retrive branch index for it
+ // and retrieve branch index for it
const auto& merge_input = merge_node->input(input_ind);
const auto& input_value = merge_node->input_value(input_ind);
const shared_ptr<const Node>& merge_producer = merge_node->get_input_node_shared_ptr(input_ind);
diff --git a/src/frontends/tensorflow/src/transformations/uninitialized_variable_resolve.cpp b/src/frontends/tensorflow/src/transformations/uninitialized_variable_resolve.cpp
index 89299370ea3..96a065dda64 100644
--- a/src/frontends/tensorflow/src/transformations/uninitialized_variable_resolve.cpp
+++ b/src/frontends/tensorflow/src/transformations/uninitialized_variable_resolve.cpp
@@ -21,26 +21,26 @@ ov::frontend::tensorflow::pass::UninitializedVariableResolver::UninitializedVari
matcher_pass_callback callback = [=](pattern::Matcher& m) {
NodeRegistry rg;
- auto unitialized_hash_table = ov::as_type_ptr<ov::frontend::tensorflow::HashTable>(m.get_match_root());
- if (!unitialized_hash_table) {
+ auto uninitialized_hash_table = ov::as_type_ptr<ov::frontend::tensorflow::HashTable>(m.get_match_root());
+ if (!uninitialized_hash_table) {
return false;
}
- auto keys = unitialized_hash_table->get_keys();
- auto values = unitialized_hash_table->get_values();
+ auto keys = uninitialized_hash_table->get_keys();
+ auto values = uninitialized_hash_table->get_values();
if (ov::as_type_ptr<HashTable>(keys.get_node_shared_ptr()) ||
ov::as_type_ptr<HashTable>(values.get_node_shared_ptr())) {
- // keys and values producer is still unitialized variable
+ // keys and values producer is still uninitialized variable
return false;
}
rg.add(keys.get_node_shared_ptr());
rg.add(values.get_node_shared_ptr());
- copy_runtime_info(unitialized_hash_table, rg.get());
+ copy_runtime_info(uninitialized_hash_table, rg.get());
- ov::replace_node(unitialized_hash_table, ov::OutputVector{unitialized_hash_table->output(0), keys, values});
+ ov::replace_node(uninitialized_hash_table, ov::OutputVector{uninitialized_hash_table->output(0), keys, values});
return true;
};
diff --git a/src/frontends/tensorflow/src/transformations/uninitialized_variable_resolve.hpp b/src/frontends/tensorflow/src/transformations/uninitialized_variable_resolve.hpp
index 7f85c5782e0..c1ace31f19d 100644
--- a/src/frontends/tensorflow/src/transformations/uninitialized_variable_resolve.hpp
+++ b/src/frontends/tensorflow/src/transformations/uninitialized_variable_resolve.hpp
@@ -15,7 +15,7 @@ namespace frontend {
namespace tensorflow {
namespace pass {
-// This transformation tries to resolve unitialized variables (like HashTable)
+// This transformation tries to resolve uninitialized variables (like HashTable)
// it borrows value of Variable that was used for some state (or node) in a graph
class UninitializedVariableResolver : public ov::pass::MatcherPass {
public:
diff --git a/src/frontends/tensorflow/src/translate_session.cpp b/src/frontends/tensorflow/src/translate_session.cpp
index 0eb26f2bf87..28647180d18 100644
--- a/src/frontends/tensorflow/src/translate_session.cpp
+++ b/src/frontends/tensorflow/src/translate_session.cpp
@@ -308,7 +308,7 @@ void fuse_loop_cond(std::shared_ptr<LoopCond>& loop_cond,
merge->output(0).replace(param_node->output(0));
}
- // create condition model to inject inside Loop operaion
+ // create condition model to inject inside Loop operation
auto cond_model_params = cond_model->get_parameters();
for (const auto& op : cond_model->get_ordered_ops()) {
auto merge = ov::as_type_ptr<Merge>(op);
@@ -850,7 +850,7 @@ std::shared_ptr<ov::Model> TranslateSession::get_body_ov_model(const std::string
body_input_model->set_partial_shape(body_input_place, input_shapes[input_ind]);
}
// set variable to the corresponding place
- // it is needed to propogate variable values inside a body graph like HashTable
+ // it is needed to propagate variable values inside a body graph like HashTable
// without this, conversion of LookupTableFind operations will not be possible
if (const auto& input_var = as_type_ptr<Variable>(ov_inputs[input_ind].get_node_shared_ptr())) {
body_input_model->set_variable(body_input_place, input_var);
diff --git a/src/frontends/tensorflow/src/variables_index.hpp b/src/frontends/tensorflow/src/variables_index.hpp
index b4cdc7f4a66..b120beba255 100644
--- a/src/frontends/tensorflow/src/variables_index.hpp
+++ b/src/frontends/tensorflow/src/variables_index.hpp
@@ -160,7 +160,7 @@ private:
uint32_t& offset,
uint32_t& offset_end);
/// \brief Reads key=value pair from provided pointer
- /// \param[in,out] ptr Actual pointer, will be moved to the end of readed pair (to read next)
+ /// \param[in,out] ptr Actual pointer, will be moved to the end of read pair (to read next)
/// \param[in] ptr_end End of memory which shouldn't be passed in case of broken structure
/// \param[out] key Key name
/// \param[out] value Stored value for key (isn't a pure string, data block)
diff --git a/src/frontends/tensorflow/tests/convert_saved_model.cpp b/src/frontends/tensorflow/tests/convert_saved_model.cpp
index 477c8a0bb6c..e70b897b2d8 100644
--- a/src/frontends/tensorflow/tests/convert_saved_model.cpp
+++ b/src/frontends/tensorflow/tests/convert_saved_model.cpp
@@ -172,7 +172,7 @@ TEST_F(FrontEndConversionWithReferenceTestsF, SavedModelWithNumericalNames) {
comparator.enable(FunctionsComparator::CmpValues::TENSOR_NAMES);
// The test aims to check that model with only numerical names for operation
// is successfully converted
- // it is a tricky case because colision between naming input and output ports may occur
+ // it is a tricky case because collision between naming input and output ports may occur
{ model = convert_model("saved_model_with_numerical_names"); }
{
// create a reference graph
diff --git a/src/frontends/tensorflow_common/src/op/crop_and_resize.cpp b/src/frontends/tensorflow_common/src/op/crop_and_resize.cpp
index 356f8139511..7cc332a1b62 100644
--- a/src/frontends/tensorflow_common/src/op/crop_and_resize.cpp
+++ b/src/frontends/tensorflow_common/src/op/crop_and_resize.cpp
@@ -26,13 +26,13 @@ OutputVector translate_crop_and_resize_bilinear(const NodeContext& node) {
auto box_ind = node.get_input(2);
auto crop_size = node.get_input(3);
- // try to retrive crop_size as the constant, otherwise, we cannot support it
+ // try to retrieve crop_size as the constant, otherwise, we cannot support it
Shape crop_sizes;
get_const_input(node, 3, &crop_sizes);
// concatenate boxes and box_ind inputs because
// ROIPooling accepts ROIs in a format [batch_id, x_1, y_1, x_2, y_2]
- // prepare box_ind for futher concatenation
+ // prepare box_ind for further concatenation
auto const_one = make_shared<v0::Constant>(element::i32, Shape{1}, 1);
box_ind = make_shared<v0::Unsqueeze>(box_ind, const_one);
box_ind = make_shared<v0::Convert>(box_ind, element::f32);
@@ -54,7 +54,7 @@ OutputVector translate_crop_and_resize_bilinear(const NodeContext& node) {
}
OutputVector translate_crop_and_resize_op(const NodeContext& node) {
- // retieve attributes
+ // retrieve attributes
// some cases like non-zero extrapolation_value are not supported
auto method = node.get_attribute<string>("method", "bilinear");
auto extrapolation_value = node.get_attribute<float>("extrapolation_value", 0.0f);
diff --git a/src/frontends/tensorflow_common/src/op/ctc_loss.cpp b/src/frontends/tensorflow_common/src/op/ctc_loss.cpp
index c823194b934..5915e02975f 100644
--- a/src/frontends/tensorflow_common/src/op/ctc_loss.cpp
+++ b/src/frontends/tensorflow_common/src/op/ctc_loss.cpp
@@ -65,7 +65,7 @@ OutputVector translate_ctc_loss_op(const NodeContext& node) {
auto labels = make_shared<v3::Broadcast>(minus_one, dense_shape)->output(0);
labels = make_shared<v3::ScatterNDUpdate>(labels, decoded_indices, decoded_values);
- // compute label_lenght for each batch
+ // compute label_length for each batch
auto minus_one_mask = make_shared<v1::Equal>(labels, minus_one);
auto mask01 = make_shared<v1::Select>(minus_one_mask,
make_shared<v0::Constant>(element::i64, Shape{}, 0),
diff --git a/src/frontends/tensorflow_common/src/op/depthwise_conv_2d.cpp b/src/frontends/tensorflow_common/src/op/depthwise_conv_2d.cpp
index f0aaa068bec..901fd3dd0c3 100644
--- a/src/frontends/tensorflow_common/src/op/depthwise_conv_2d.cpp
+++ b/src/frontends/tensorflow_common/src/op/depthwise_conv_2d.cpp
@@ -21,7 +21,7 @@ OutputVector translate_depthwise_conv_2d_native_op(const NodeContext& node) {
auto input = node.get_input(0);
auto filter = node.get_input(1);
- // retrive mandatory attributes for DepthwiseConv2dNative
+ // retrieve mandatory attributes for DepthwiseConv2dNative
auto tf_strides = node.get_attribute<std::vector<int64_t>>("strides");
auto tf_padding_type = node.get_attribute<std::string>("padding");
ov::op::PadType auto_pad = convert_tf_padding(node, tf_padding_type);
diff --git a/src/frontends/tensorflow_common/src/op/div_no_nan.cpp b/src/frontends/tensorflow_common/src/op/div_no_nan.cpp
index f264fecaa82..1093ce2aa8b 100644
--- a/src/frontends/tensorflow_common/src/op/div_no_nan.cpp
+++ b/src/frontends/tensorflow_common/src/op/div_no_nan.cpp
@@ -27,17 +27,17 @@ OutputVector translate_div_no_nan_op(const NodeContext& node) {
zero = make_shared<v1::ConvertLike>(zero, denom);
one = make_shared<v1::ConvertLike>(one, denom);
- // compute a mask to get positions of Nan values of division result
+ // compute a mask to get positions of NaN values of division result
auto is_zero = make_shared<v1::Equal>(denom, zero);
- // fix zeros in the denomimator to avoid undefined behaviour
+ // fix zeros in the denominator to avoid undefined behaviour
auto fixed_denom = make_shared<v1::Select>(is_zero, one, denom);
- // compute Division and do not afraid division by zero
+ // compute Division and do not fear division by zero
// since all of them fixed
auto div = make_shared<v1::Divide>(numer, fixed_denom);
- // set zero to the result where initially the denomimator is zero
+ // set zero to the result where initially the denominator is zero
auto div_no_nan = make_shared<v1::Select>(is_zero, zero, div);
set_node_name(node.get_name(), div_no_nan);
return div_no_nan->outputs();
diff --git a/src/frontends/tensorflow_common/src/op/fused_batch_norm.cpp b/src/frontends/tensorflow_common/src/op/fused_batch_norm.cpp
index bc0153d7402..f72ccad9c01 100644
--- a/src/frontends/tensorflow_common/src/op/fused_batch_norm.cpp
+++ b/src/frontends/tensorflow_common/src/op/fused_batch_norm.cpp
@@ -265,7 +265,7 @@ NamedOutputVector translate_fused_batch_norm_op(const NodeContext& node) {
compute_fused_batch_norm_inference(node, fused_batch_norm, batch_mean, batch_variance);
}
- // create fictious output for reserved outputs of FusedBatchNorm operation
+ // create fictitious output for reserved outputs of FusedBatchNorm operation
auto zero_const = create_same_type_const_scalar<float>(scale, 0);
auto zero_const2 = create_same_type_const_scalar<float>(scale, 0);
diff --git a/src/frontends/tensorflow_common/src/op/reverse.cpp b/src/frontends/tensorflow_common/src/op/reverse.cpp
index f3af34dbed1..2a060eacdf5 100644
--- a/src/frontends/tensorflow_common/src/op/reverse.cpp
+++ b/src/frontends/tensorflow_common/src/op/reverse.cpp
@@ -68,9 +68,9 @@ OutputVector translate_reverse_base_op(const NodeContext& node,
}
auto input_shape = make_shared<v3::ShapeOf>(batched_input, element::i32);
- auto seq_lenghts = compute_sequence_lengths(input_shape, batch_axis, seq_axis);
+ auto seq_lengths = compute_sequence_lengths(input_shape, batch_axis, seq_axis);
auto reverse_sequence =
- make_shared<v0::ReverseSequence>(batched_input, seq_lenghts, batch_axis, seq_axis)->output(0);
+ make_shared<v0::ReverseSequence>(batched_input, seq_lengths, batch_axis, seq_axis)->output(0);
if (unsqueeze_axes.size() > 0) {
// remove earlier added additional dimensions from the result
diff --git a/src/frontends/tensorflow_common/src/op/size.cpp b/src/frontends/tensorflow_common/src/op/size.cpp
index 90ebe84714b..eabf7a9d802 100644
--- a/src/frontends/tensorflow_common/src/op/size.cpp
+++ b/src/frontends/tensorflow_common/src/op/size.cpp
@@ -26,7 +26,7 @@ ov::OutputVector translate_size_op(const NodeContext& node) {
auto complex_type_mark = as_type_ptr<ComplexTypeMark>(input.get_node_shared_ptr());
- // retrive attribute of the output type
+ // retrieve attribute of the output type
auto out_type = node.get_attribute<element::Type>("out_type", element::i32);
if (complex_type_mark) {
diff --git a/src/frontends/tensorflow_common/src/op/space_to_batch_nd.cpp b/src/frontends/tensorflow_common/src/op/space_to_batch_nd.cpp
index af4993acf9e..0667017380f 100644
--- a/src/frontends/tensorflow_common/src/op/space_to_batch_nd.cpp
+++ b/src/frontends/tensorflow_common/src/op/space_to_batch_nd.cpp
@@ -39,7 +39,7 @@ void normalize_block_shape_pads_crops(const NodeContext& node,
auto M = make_shared<v3::ShapeOf>(block_shape, element::i32);
// compute a number of padding elements required to normalize block_shape
- // in the beggining and in the end
+ // in the beginning and in the end
auto num_begin = make_shared<v0::Constant>(element::i32, Shape{1}, 1);
auto num_end = make_shared<v1::Subtract>(input_rank, M)->output(0);
num_end = make_shared<v1::Subtract>(num_end, num_begin)->output(0);
diff --git a/src/frontends/tensorflow_common/src/utils.cpp b/src/frontends/tensorflow_common/src/utils.cpp
index f07a8b88d73..d753625e5c5 100644
--- a/src/frontends/tensorflow_common/src/utils.cpp
+++ b/src/frontends/tensorflow_common/src/utils.cpp
@@ -277,7 +277,7 @@ OutputVector translate_convolution_op(const frontend::NodeContext& node, size_t
// assumption to use regular convolution for all other cases is taken from the legacy frontend
// this solution is sufficient for all observed models in the validation
// in general, it has limitation and it needs to use grouped convolution when num_groups is not static
- // 118107: remove this assumtpion when it obtains complete shape propagation in the core
+ // 118107: remove this assumption when it obtains complete shape propagation in the core
conv = make_shared<v1::Convolution>(input, filter, strides, pads_begin, pads_end, dilations, auto_pad);
}
diff --git a/src/frontends/tensorflow_lite/src/graph_iterator_flatbuffer.hpp b/src/frontends/tensorflow_lite/src/graph_iterator_flatbuffer.hpp
index 4cfe890a0d1..591219a8bcf 100644
--- a/src/frontends/tensorflow_lite/src/graph_iterator_flatbuffer.hpp
+++ b/src/frontends/tensorflow_lite/src/graph_iterator_flatbuffer.hpp
@@ -80,7 +80,7 @@ public:
#endif
char buf[offset_size * 2 + 1] = {}; // +1 is used to overcome gcc's -Wstringop-overread warning
tflite_stream.read(buf, offset_size * 2);
- // If we have enough readed bytes - try to detect prefixed identifier, else try without size prefix
+ // If we have enough read bytes - try to detect prefixed identifier, else try without size prefix
if ((tflite_stream.gcount() == offset_size * 2) && ::tflite::ModelBufferHasIdentifier(buf + offset_size)) {
return true;
} else if (tflite_stream.gcount() >= offset_size && ::tflite::ModelBufferHasIdentifier(buf)) {
diff --git a/tests/layer_tests/pytorch_tests/test_dict.py b/tests/layer_tests/pytorch_tests/test_dict.py
index 1a814b30c21..7fcbb18ffa7 100644
--- a/tests/layer_tests/pytorch_tests/test_dict.py
+++ b/tests/layer_tests/pytorch_tests/test_dict.py
@@ -12,7 +12,8 @@ from pytorch_layer_test_class import PytorchLayerTest
class TestDict(PytorchLayerTest):
def _prepare_input(self):
- return (np.random.randn(2, 5, 3, 4).astype(np.float32),)
+ rng = np.random.default_rng(0)
+ return (rng.standard_normal((2, 5, 3, 4), dtype=np.float32),)
def create_model(self):
class aten_dict(torch.nn.Module):
@@ -41,8 +42,9 @@ class aten_dict_no_types(torch.nn.Module):
class TestDictParam(PytorchLayerTest):
def _prepare_input(self):
- return ({"x1": np.random.randn(2, 5, 3, 4).astype(np.float32),
- "x2": np.random.randn(2, 5, 3, 4).astype(np.float32)},)
+ rng = np.random.default_rng(0)
+ return ({"x1": rng.standard_normal((2, 5, 3, 4), dtype=np.float32),
+ "x2": rng.standard_normal((2, 5, 3, 4), dtype=np.float32)},)
@pytest.mark.nightly
@pytest.mark.precommit
@@ -65,3 +67,26 @@ class TestDictParam(PytorchLayerTest):
def test_dict_param_no_types(self, ie_device, precision, ir_version):
self._test(aten_dict_no_types(), None, "aten::__getitem__", ie_device, precision,
ir_version, trace_model=True, freeze_model=False)
+
+
+class aten_dict_mixed_inputs(torch.nn.Module):
+ def forward(self, x_dict: dict[str, torch.Tensor], y: torch.Tensor):
+ # one dict key is consumed alongside a regular tensor input; the other bypasses
+ return x_dict["x1"] + y, x_dict["x2"]
+
+
+class TestDictParamMixed(PytorchLayerTest):
+
+ def _prepare_input(self):
+ rng = np.random.default_rng(0)
+ x1 = rng.standard_normal((1, 3, 4), dtype=np.float32)
+ x2 = rng.standard_normal((1, 3, 4), dtype=np.float32)
+ y = rng.standard_normal((1, 3, 4), dtype=np.float32)
+ return ({"x1": x1, "x2": x2}, y)
+
+ @pytest.mark.nightly
+ @pytest.mark.precommit
+ def test_dict_param_mixed_inputs(self, ie_device, precision, ir_version):
+ # Regression: ensure dict parameter resolution does not drop unrelated inputs
+ self._test(aten_dict_mixed_inputs(), None, "aten::__getitem__", ie_device, precision,
+ ir_version, trace_model=True, freeze_model=False)
diff --git a/tests/layer_tests/pytorch_tests/test_linspace.py b/tests/layer_tests/pytorch_tests/test_linspace.py
index 76f870e74dd..90e4275b840 100644
--- a/tests/layer_tests/pytorch_tests/test_linspace.py
+++ b/tests/layer_tests/pytorch_tests/test_linspace.py
@@ -63,7 +63,7 @@ class TestLinspace(PytorchLayerTest):
@pytest.mark.precommit
@pytest.mark.parametrize("dtype", ["float32", "float64", "int32", "int64", "int8"])
@pytest.mark.parametrize(
- "start,end,steps", [(0, 1, 5), (-2, 1, 5), (1, -5, 7), (1, 10, 2), (-1, -5, 2), (-1, -5, 1), (1.25, -5.5, 5)]
+ "start,end,steps", [(0, 1, 5), (-2, 1, 5), (1, -5, 7), (1, 10, 2), (-1, -5, 2), (-1, -5, 1), (1.25, -5.5, 5), (2, 2, 1)]
)
@pytest.mark.xfail(condition=platform.system() == 'Darwin' and platform.machine() == 'arm64',
reason='Ticket - 122715')
@@ -80,7 +80,7 @@ class TestLinspace(PytorchLayerTest):
@pytest.mark.precommit
@pytest.mark.parametrize("dtype", [None, "float32", "float64", "int32", "int64", "int8", "uin8"])
@pytest.mark.parametrize(
- "start,end,steps", [(0, 1, 5), (-2, 1, 5), (1, -5, 7), (1, 10, 2), (-1, -5, 2), (-1, -5, 1), (1.25, -5.5, 5)]
+ "start,end,steps", [(0, 1, 5), (-2, 1, 5), (1, -5, 7), (1, 10, 2), (-1, -5, 2), (-1, -5, 1), (1.25, -5.5, 5), (2, 2, 1)]
)
@pytest.mark.parametrize("use_out", [False, True])
@pytest.mark.xfail(condition=platform.system() == 'Darwin' and platform.machine() == 'arm64',