diff --git a/docs/articles_en/openvino_workflow/running_inference_with_openvino/integrate_with_your_application/model_representation.rst b/docs/articles_en/openvino_workflow/running_inference_with_openvino/integrate_with_your_application/model_representation.rst index 7604d61c0f3..2c16c00c197 100644 --- a/docs/articles_en/openvino_workflow/running_inference_with_openvino/integrate_with_your_application/model_representation.rst +++ b/docs/articles_en/openvino_workflow/running_inference_with_openvino/integrate_with_your_application/model_representation.rst @@ -8,24 +8,33 @@ Model Representation in OpenVINO™ Runtime :description: In OpenVINO™ Runtime a model is represented by special classes to work with model data types and shapes. -In OpenVINO™ Runtime, a model is represented by the ``:ref:`ov::Model ``` class. +In OpenVINO™ Runtime, a model is represented by the ``ov::Model`` class. -The ``:ref:`ov::Model ``` object stores shared pointers to ``:ref:`ov::op::v0::Parameter ```, ``:ref:`ov::op::v0::Result ```, and ``:ref:`ov::op::Sink ``` operations, which are inputs, outputs, and sinks of the graph. Sinks of the graph have no consumers and are not included in the results vector. All other operations hold each other via shared pointers, in which a child operation holds its parent via a hard link. If an operation has no consumers and is neither the ``Result`` nor the ``Sink`` operation whose shared pointer counter is zero, the operation will be destructed and not be accessible anymore. +The ``ov::Model`` object stores shared pointers to ``ov::op::v0::Parameter``, ``ov::op::v0::Result``, and ``ov::op::Sink`` operations, +which are inputs, outputs, and sinks of the graph. Sinks of the graph have no consumers and are not included in the results vector. +All other operations hold each other via shared pointers, in which a child operation holds its parent via a hard link. If an operation +has no consumers and is neither the ``Result`` nor the ``Sink`` operation whose shared pointer counter is zero, the operation will be +destructed and not be accessible anymore. -Each operation in ``:ref:`ov::Model ``` has the ``std::shared_ptr<:ref:`ov::Node `>`` type. +Each operation in ``ov::Model`` has the ``std::shared_ptr`` type. How OpenVINO Runtime Works with Models ######################################### OpenVINO™ Runtime enables you to use different approaches to work with model inputs/outputs: -* The ``:ref:`ov::Model::inputs() ``` / ``:ref:`ov::Model::outputs() ``` methods are used to get vectors of all input/output ports. +* The ``ov::Model::inputs()`` / ``ov::Model::outputs()`` methods are used to get vectors of all input/output ports. -* For a model that has only one input or output, you can use the ``:ref:`ov::Model::input() ``` or ``:ref:`ov::Model::output() ``` methods without any arguments to get input or output port respectively. +* For a model that has only one input or output, you can use the ``ov::Model::input()`` or ``ov::Model::output()`` methods without + any arguments to get input or output port respectively. -* The ``:ref:`ov::Model::input() ``` and ``:ref:`ov::Model::output() ``` methods can be used with the index of inputs or outputs from the framework model to get specific ports by index. +* The ``ov::Model::input()`` and ``ov::Model::output()`` methods can be used with the index of inputs or outputs from the framework + model to get specific ports by index. -* You can use the tensor name of input or output from the original framework model together with the ``:ref:`ov::Model::input() ``` or ``:ref:`ov::Model::output() ``` methods to get specific ports. It means that you do not need to have any additional mapping of names from framework to OpenVINO as it was before. OpenVINO Runtime allows the usage of native framework tensor names, for example: +* You can use the tensor name of input or output from the original framework model together with the + ``ov::Model::input()`` or ``ov::Model::output()`` methods to get specific ports. It means that you do not need to have any + additional mapping of names from framework to OpenVINO as it was before. OpenVINO Runtime allows the usage of native framework + tensor names, for example: .. tab-set:: @@ -44,20 +53,23 @@ OpenVINO™ Runtime enables you to use different approaches to work with model i :fragment: [all_inputs_ouputs] -For details on how to build a model in OpenVINO™ Runtime, see the :ref:`Build a Model in OpenVINO Runtime ` section. +For details on how to build a model in OpenVINO™ Runtime, see the :ref:`Build a Model in OpenVINO Runtime ` section. -OpenVINO™ Runtime model representation uses special classes to work with model data types and shapes. The ``:ref:`ov::element::Type ``` is used for data types. See the section below for representation of shapes. +OpenVINO™ Runtime model representation uses special classes to work with model data types and shapes. The ``ov::element::Type`` +is used for data types. See the section below for representation of shapes. Representation of Shapes ########################### -OpenVINO™ Runtime provides two types for shape representation: +OpenVINO™ Runtime provides two types for shape representation: -* ``:ref:`ov::Shape ``` - Represents static (fully defined) shapes. +* ``ov::Shape`` - Represents static (fully defined) shapes. -* ``:ref:`ov::PartialShape ``` - Represents dynamic shapes. This means that the rank or some of dimensions are dynamic (dimension defines an interval or undefined). +* ``ov::PartialShape`` - Represents dynamic shapes. This means that the rank or some of dimensions are dynamic + (dimension defines an interval or undefined). -``:ref:`ov::PartialShape ``` can be converted to ``:ref:`ov::Shape ``` by using the ``get_shape()`` method if all dimensions are static; otherwise, the conversion will throw an exception. For example: +``ov::PartialShape`` can be converted to ``ov::Shape`` by using the ``get_shape()`` method if all dimensions are static; otherwise, +the conversion will throw an exception. For example: .. tab-set:: @@ -81,15 +93,18 @@ However, in most cases, before getting static shape using the ``get_shape()`` me Representation of Operations ################################ -The ``ov::Op`` class represents any abstract operation in the model representation. Use this class to create :doc:`custom operations `. +The ``ov::Op`` class represents any abstract operation in the model representation. Use this class to create +:doc:`custom operations `. Representation of Operation Sets ###################################### -An operation set (opset) is a collection of operations that can be used to construct a model. The ``:ref:`ov::OpSet ``` class provides the functionality to work with operation sets. +An operation set (opset) is a collection of operations that can be used to construct a model. The ``ov::OpSet`` class provides +the functionality to work with operation sets. For each operation set, OpenVINO™ Runtime provides a separate namespace, for example ``opset8``. -Each OpenVINO™ Release introduces new operations and adds them to new operation sets, within which the new operations would change the behavior of previous operations. Using operation sets helps you avoid changing your application when new operations are introduced. +Each OpenVINO™ Release introduces new operations and adds them to new operation sets, within which the new operations would change +the behavior of previous operations. Using operation sets helps you avoid changing your application when new operations are introduced. For a complete list of operation sets supported in OpenVINO™ toolkit, see the :doc:`Available Operations Sets `. To add the support for custom operations, see :doc:`OpenVINO Extensibility Mechanism `. @@ -100,9 +115,10 @@ Building a Model in OpenVINO™ Runtime You can create a model from source. This section illustrates how to construct a model composed of operations from an available operation set. -Operation set ``opsetX`` integrates a list of pre-compiled operations that work for this purpose. In other words, ``opsetX`` defines a set of operations for building a graph. +Operation set ``opsetX`` integrates a list of pre-compiled operations that work for this purpose. In other words, ``opsetX`` +defines a set of operations for building a graph. -To build an ``:ref:`ov::Model ``` instance from ``opset8`` operations, include the following files: +To build an ``ov::Model`` instance from ``opset8`` operations, include the following files: .. tab-set:: @@ -164,7 +180,8 @@ Model Debugging Capabilities OpenVINO™ provides several debug capabilities: -* To receive additional messages about applied model modifications, rebuild the OpenVINO™ Runtime library with the ``-DENABLE_OPENVINO_DEBUG=ON`` option. +* To receive additional messages about applied model modifications, rebuild the OpenVINO™ Runtime library with the + ``-DENABLE_OPENVINO_DEBUG=ON`` option. * Model can be visualized to image from the xDot format: @@ -186,7 +203,7 @@ OpenVINO™ provides several debug capabilities: .. code-block:: sh - + `ov::pass::VisualizeTree` can be parametrized via environment variables: OV_VISUALIZE_TREE_OUTPUT_SHAPES=1 - visualize shapes