[Python API] Update doc style (#10708)

* [Python API] Update doc style

* apply comments

Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
This commit is contained in:
Anastasia Kuporosova 2022-03-11 19:18:20 +03:00 committed by GitHub
parent 7790f2036f
commit 23604ca28c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 279 additions and 542 deletions

View File

@ -19,14 +19,6 @@ void regclass_VariableState(py::module m) {
R"( R"(
Reset internal variable state for relevant infer request, Reset internal variable state for relevant infer request,
to a value specified as default for according node. to a value specified as default for according node.
Parameters
----------
None
Returns
----------
reset : None
)"); )");
variable_st.def_property_readonly("name", variable_st.def_property_readonly("name",
@ -34,10 +26,8 @@ void regclass_VariableState(py::module m) {
R"( R"(
Gets name of current variable state. Gets name of current variable state.
Returns :return: A string representing a state name.
---------- :rtype: str
reset : str
A string representing a state name.
)"); )");
variable_st.def_property("state", variable_st.def_property("state",
@ -45,15 +35,5 @@ void regclass_VariableState(py::module m) {
&ov::VariableState::set_state, &ov::VariableState::set_state,
R"( R"(
Gets/sets variable state. Gets/sets variable state.
Parameters
----------
state : openvino.runtime.Tensor
The current state to set.
Returns
----------
state : openvino.runtime.Tensor
A tensor representing a state.
)"); )");
} }

View File

@ -29,15 +29,10 @@ void regclass_frontend_FrontEnd(py::module m) {
R"( R"(
Loads an input model by specified model file path. Loads an input model by specified model file path.
Parameters :param path: Main model file path.
---------- :type path: str
path : str :return: Loaded input model.
Main model file path. :rtype: openvino.frontend.InputModel
Returns
----------
load : InputModel
Loaded input model.
)"); )");
fem.def("convert", fem.def("convert",
@ -47,27 +42,22 @@ void regclass_frontend_FrontEnd(py::module m) {
R"( R"(
Completely convert and normalize entire function, throws if it is not possible. Completely convert and normalize entire function, throws if it is not possible.
Parameters :param model: Input model.
---------- :type model: openvino.frontend.InputModel
model : InputModel :return: Fully converted OpenVINO Model.
Input model. :rtype: openvino.runtime.Model
Returns
----------
convert : Model
Fully converted nGraph function.
)"); )");
fem.def("convert", fem.def("convert",
static_cast<void (FrontEnd::*)(const std::shared_ptr<ov::Model>&) const>(&FrontEnd::convert), static_cast<void (FrontEnd::*)(const std::shared_ptr<ov::Model>&) const>(&FrontEnd::convert),
py::arg("function"), py::arg("model"),
R"( R"(
Completely convert the remaining, not converted part of a function. Completely convert the remaining, not converted part of a function.
Parameters :param model: Partially converted OpenVINO model.
---------- :type model: openvino.frontend.Model
function : Model :return: Fully converted OpenVINO Model.
Partially converted nGraph function. :rtype: openvino.runtime.Model
)"); )");
fem.def("convert_partially", fem.def("convert_partially",
@ -79,15 +69,10 @@ void regclass_frontend_FrontEnd(py::module m) {
Converted parts are not normalized by additional transformations; normalize function or Converted parts are not normalized by additional transformations; normalize function or
another form of convert function should be called to finalize the conversion process. another form of convert function should be called to finalize the conversion process.
Parameters :param model : Input model.
---------- :type model: openvino.frontend.InputModel
model : InputModel :return: Partially converted OpenVINO Model.
Input model. :rtype: openvino.runtime.Model
Returns
----------
convert_partially : Model
Partially converted nGraph function.
)"); )");
fem.def("decode", fem.def("decode",
@ -99,27 +84,20 @@ void regclass_frontend_FrontEnd(py::module m) {
Each decoding node is an nGraph node representing a single FW operation node with Each decoding node is an nGraph node representing a single FW operation node with
all attributes represented in FW-independent way. all attributes represented in FW-independent way.
Parameters :param model : Input model.
---------- :type model: openvino.frontend.InputModel
model : InputModel :return: OpenVINO Model after decoding.
Input model. :rtype: openvino.runtime.Model
Returns
----------
decode : Model
nGraph function after decoding.
)"); )");
fem.def("normalize", fem.def("normalize",
&FrontEnd::normalize, &FrontEnd::normalize,
py::arg("function"), py::arg("model"),
R"( R"(
Runs normalization passes on function that was loaded with partial conversion. Runs normalization passes on function that was loaded with partial conversion.
Parameters :param model : Partially converted OpenVINO model.
---------- :type model: openvino.runtime.Model
function : Model
Partially converted nGraph function.
)"); )");
fem.def("get_name", fem.def("get_name",
@ -128,10 +106,8 @@ void regclass_frontend_FrontEnd(py::module m) {
Gets name of this FrontEnd. Can be used by clients Gets name of this FrontEnd. Can be used by clients
if frontend is selected automatically by FrontEndManager::load_by_model. if frontend is selected automatically by FrontEndManager::load_by_model.
Parameters :return: Current frontend name. Returns empty string if not implemented.
---------- :rtype: str
get_name : str
Current frontend name. Empty string if not implemented.
)"); )");
fem.def("add_extension", fem.def("add_extension",

View File

@ -25,15 +25,10 @@ void regclass_frontend_InputModel(py::module m) {
Returns a tensor place by a tensor name following framework conventions, or Returns a tensor place by a tensor name following framework conventions, or
nullptr if a tensor with this name doesn't exist. nullptr if a tensor with this name doesn't exist.
Parameters :param tensor_name: Name of tensor.
---------- :type tensor_name: str
tensor_name : str :return: Tensor place corresponding to specified tensor name.
Name of tensor. :rtype: openvino.frontend.Place
Returns
----------
get_place_by_tensor_name : Place
Tensor place corresponding to specified tensor name.
)"); )");
im.def("get_place_by_operation_name", im.def("get_place_by_operation_name",
@ -43,15 +38,10 @@ void regclass_frontend_InputModel(py::module m) {
Returns an operation place by an operation name following framework conventions, or Returns an operation place by an operation name following framework conventions, or
nullptr if an operation with this name doesn't exist. nullptr if an operation with this name doesn't exist.
Parameters :param operation_name: Name of operation.
---------- :type operation_name: str
operation_name : str :return: Place representing operation.
Name of operation. :rtype: openvino.frontend.Place
Returns
----------
get_place_by_operation_name : Place
Place representing operation.
)"); )");
im.def("get_place_by_operation_name_and_input_port", im.def("get_place_by_operation_name_and_input_port",
@ -61,18 +51,12 @@ void regclass_frontend_InputModel(py::module m) {
R"( R"(
Returns an input port place by operation name and appropriate port index. Returns an input port place by operation name and appropriate port index.
Parameters :param operation_name: Name of operation.
---------- :type operation_name: str
operation_name : str :param input_port_index: Index of input port for this operation.
Name of operation. :type input_port_index: int
:return: Place representing input port of operation.
input_port_index : int :rtype: openvino.frontend.Place
Index of input port for this operation.
Returns
----------
get_place_by_operation_name_and_input_port : Place
Place representing input port of operation.
)"); )");
im.def("get_place_by_operation_name_and_output_port", im.def("get_place_by_operation_name_and_output_port",
@ -82,18 +66,12 @@ void regclass_frontend_InputModel(py::module m) {
R"( R"(
Returns an output port place by operation name and appropriate port index. Returns an output port place by operation name and appropriate port index.
Parameters :param operation_name: Name of operation.
---------- :type operation_name: str
operation_name : str :param output_port_index: Index of output port for this operation.
Name of operation. :type output_port_index: int
:return: Place representing output port of operation.
output_port_index : int :rtype: openvino.frontend.Place
Index of output port for this operation.
Returns
----------
get_place_by_operation_name_and_output_port : Place
Place representing output port of operation.
)"); )");
im.def("set_name_for_tensor", im.def("set_name_for_tensor",
@ -103,13 +81,10 @@ void regclass_frontend_InputModel(py::module m) {
R"( R"(
Sets name for tensor. Overwrites existing names of this place. Sets name for tensor. Overwrites existing names of this place.
Parameters :param tensor: Tensor place.
---------- :type tensor: openvino.frontend.Place
tensor : Place :param new_name: New name for this tensor.
Tensor place. :type new_name: str
new_name : str
New name for this tensor.
)"); )");
im.def("add_name_for_tensor", im.def("add_name_for_tensor",
@ -119,13 +94,10 @@ void regclass_frontend_InputModel(py::module m) {
R"( R"(
Adds new name for tensor Adds new name for tensor
Parameters :param tensor: Tensor place.
---------- :type tensor: openvino.frontend.Place
tensor : Place :param new_name: New name to be added to this place.
Tensor place. :type new_name: str
new_name : str
New name to be added to this place.
)"); )");
im.def("set_name_for_operation", im.def("set_name_for_operation",
@ -135,13 +107,10 @@ void regclass_frontend_InputModel(py::module m) {
R"( R"(
Adds new name for tensor. Adds new name for tensor.
Parameters :param operation: Operation place.
---------- :type operation: openvino.frontend.Place
operation : Place :param new_name: New name for this operation.
Operation place. :type new_name: str
new_name : str
New name for this operation.
)"); )");
im.def("free_name_for_tensor", im.def("free_name_for_tensor",
@ -150,10 +119,8 @@ void regclass_frontend_InputModel(py::module m) {
R"( R"(
Unassign specified name from tensor place(s). Unassign specified name from tensor place(s).
Parameters :param name: Name of tensor.
---------- :type name: str
name : str
Name of tensor.
)"); )");
im.def("free_name_for_operation", im.def("free_name_for_operation",
@ -162,10 +129,8 @@ void regclass_frontend_InputModel(py::module m) {
R"( R"(
Unassign specified name from operation place(s). Unassign specified name from operation place(s).
Parameters :param name: Name of operation.
---------- :type name: str
name : str
Name of operation.
)"); )");
im.def("set_name_for_dimension", im.def("set_name_for_dimension",
@ -176,16 +141,12 @@ void regclass_frontend_InputModel(py::module m) {
R"( R"(
Set name for a particular dimension of a place (e.g. batch dimension). Set name for a particular dimension of a place (e.g. batch dimension).
Parameters :param place: Model's place.
---------- :type place: openvino.frontend.Place
place : Place :param dim_index: Dimension index.
Model's place. :type dim_index: int
:param dim_name: Name to assign on this dimension.
dim_index : int :type dum_name: str
Dimension index.
dim_name : str
Name to assign on this dimension.
)"); )");
im.def("cut_and_add_new_input", im.def("cut_and_add_new_input",
@ -196,13 +157,10 @@ void regclass_frontend_InputModel(py::module m) {
Cut immediately before this place and assign this place as new input; prune Cut immediately before this place and assign this place as new input; prune
all nodes that don't contribute to any output. all nodes that don't contribute to any output.
Parameters :param place: New place to be assigned as input.
---------- :type place: openvino.frontend.Place
place : Place :param new_name: Optional new name assigned to this input place.
New place to be assigned as input. :type new_name: str
new_name_optional : str
Optional new name assigned to this input place.
)"); )");
im.def("cut_and_add_new_output", im.def("cut_and_add_new_output",
@ -213,13 +171,10 @@ void regclass_frontend_InputModel(py::module m) {
Cut immediately before this place and assign this place as new output; prune Cut immediately before this place and assign this place as new output; prune
all nodes that don't contribute to any output. all nodes that don't contribute to any output.
Parameters :param place: New place to be assigned as output.
---------- :type place: openvino.frontend.Place
place : Place :param new_name: Optional new name assigned to this output place.
New place to be assigned as output. :type new_name: str
new_name_optional : str
Optional new name assigned to this output place.
)"); )");
im.def("add_output", im.def("add_output",
@ -228,10 +183,8 @@ void regclass_frontend_InputModel(py::module m) {
R"( R"(
Assign this place as new output or add necessary nodes to represent a new output. Assign this place as new output or add necessary nodes to represent a new output.
Parameters :param place: Anchor point to add an output.
---------- :type place: openvino.frontend.Place
place : Place
Anchor point to add an output.
)"); )");
im.def("remove_output", im.def("remove_output",
@ -241,10 +194,8 @@ void regclass_frontend_InputModel(py::module m) {
Removes any sinks directly attached to this place with all inbound data flow Removes any sinks directly attached to this place with all inbound data flow
if it is not required by any other output. if it is not required by any other output.
Parameters :param place: Model place.
---------- :type place: openvino.frontend.Place
place : Place
Model place
)"); )");
im.def("set_partial_shape", im.def("set_partial_shape",
@ -257,13 +208,10 @@ void regclass_frontend_InputModel(py::module m) {
shape of results ngraph nodes and will define shape inference when the model is shape of results ngraph nodes and will define shape inference when the model is
converted to ngraph. converted to ngraph.
Parameters :param place: Model place.
---------- :type place: openvino.frontend.Place
place : Place :param shape: Partial shape for this place.
Model place. :type shape: openvino.runtime.PartialShape
shape : PartialShape
Partial shape for this place.
)"); )");
im.def("get_partial_shape", im.def("get_partial_shape",
@ -272,15 +220,10 @@ void regclass_frontend_InputModel(py::module m) {
R"( R"(
Returns current partial shape used for this place. Returns current partial shape used for this place.
Parameters :param place: Model place.
---------- :type place: openvino.frontend.Place
place : Place :return: Partial shape for this place.
Model place :rtype: openvino.runtime.PartialShape
Returns
----------
get_partial_shape : PartialShape
Partial shape for this place.
)"); )");
im.def("get_inputs", im.def("get_inputs",
@ -288,10 +231,8 @@ void regclass_frontend_InputModel(py::module m) {
R"( R"(
Returns all inputs for a model. Returns all inputs for a model.
Returns :return: A list of input places.
---------- :rtype: List[openvino.frontend.Place]
get_inputs : List[Place]
A list of input places.
)"); )");
im.def("get_outputs", im.def("get_outputs",
@ -299,10 +240,8 @@ void regclass_frontend_InputModel(py::module m) {
R"( R"(
Returns all outputs for a model. An output is a terminal place in a graph where data escapes the flow. Returns all outputs for a model. An output is a terminal place in a graph where data escapes the flow.
Returns :return: A list of output places.
---------- :rtype: List[openvino.frontend.Place]
get_outputs : List[Place]
A list of output places
)"); )");
im.def("extract_subgraph", im.def("extract_subgraph",
@ -312,13 +251,10 @@ void regclass_frontend_InputModel(py::module m) {
R"( R"(
Leaves only subgraph that are defined by new inputs and new outputs. Leaves only subgraph that are defined by new inputs and new outputs.
Parameters :param inputs: Array of new input places.
---------- :type inputs: List[openvino.frontend.Place]
inputs : List[Place] :param outputs: Array of new output places.
Array of new input places. :type outputs: List[openvino.frontend.Place]
outputs : List[Place]
Array of new output places.
)"); )");
im.def("override_all_inputs", im.def("override_all_inputs",
@ -328,10 +264,8 @@ void regclass_frontend_InputModel(py::module m) {
Modifies the graph to use new inputs instead of existing ones. New inputs Modifies the graph to use new inputs instead of existing ones. New inputs
should completely satisfy all existing outputs. should completely satisfy all existing outputs.
Parameters :param inputs: Array of new input places.
---------- :type inputs: List[openvino.frontend.Place]
inputs : List[Place]
Array of new input places.
)"); )");
im.def("override_all_outputs", im.def("override_all_outputs",
@ -341,10 +275,8 @@ void regclass_frontend_InputModel(py::module m) {
Replaces all existing outputs with new ones removing all data flow that Replaces all existing outputs with new ones removing all data flow that
is not required for new outputs. is not required for new outputs.
Parameters :param outputs: Vector with places that will become new outputs; may intersect existing outputs.
---------- :type outputs: List[openvino.frontend.Place]
outputs : List[Place]
Vector with places that will become new outputs; may intersect existing outputs.
)"); )");
im.def("set_element_type", im.def("set_element_type",
@ -354,13 +286,10 @@ void regclass_frontend_InputModel(py::module m) {
R"( R"(
Sets new element type for a place. Sets new element type for a place.
Parameters :param place: Model place.
---------- :type place: openvino.frontend.Place
place : Place :param type: New element type.
Model place. :type type: openvino.runtime.Type
type : ngraph.Type
New element type.
)"); )");
im.def( im.def(
@ -375,12 +304,9 @@ void regclass_frontend_InputModel(py::module m) {
R"( R"(
Sets new element type for a place. Sets new element type for a place.
Parameters :param place: Model place.
---------- :type place: openvino.frontend.Place
place : Place :param value: New value to assign.
Model place. :type value: numpy.ndarray
value : ndarray
New value to assign.
)"); )");
} }

View File

@ -34,10 +34,8 @@ void regclass_frontend_FrontEndManager(py::module m) {
R"( R"(
Gets list of registered frontends. Gets list of registered frontends.
Returns :return: List of available frontend names.
---------- :rtype: List[str]
get_available_front_ends : List[str]
List of available frontend names.
)"); )");
fem.def("load_by_framework", fem.def("load_by_framework",
@ -46,15 +44,10 @@ void regclass_frontend_FrontEndManager(py::module m) {
R"( R"(
Loads frontend by name of framework and capabilities. Loads frontend by name of framework and capabilities.
Parameters :param framework: Framework name. Throws exception if name is not in list of available frontends.
---------- :type framework: str
framework : str :return: Frontend interface for further loading of models.
Framework name. Throws exception if name is not in list of available frontends. :rtype: openvino.frontend.FrontEnd
Returns
----------
load_by_framework : FrontEnd
Frontend interface for further loading of models.
)"); )");
fem.def( fem.def(
@ -66,15 +59,10 @@ void regclass_frontend_FrontEndManager(py::module m) {
R"( R"(
Selects and loads appropriate frontend depending on model file extension and other file info (header). Selects and loads appropriate frontend depending on model file extension and other file info (header).
Parameters :param model_path: A path to a model file/directory.
---------- :type model_path: str
model_path : str :return: Frontend interface for further loading of models. 'None' if no suitable frontend is found.
Path to model file/directory. :rtype: openvino.frontend.FrontEnd
Returns
----------
load_by_model : FrontEnd
Frontend interface for further loading of models. 'None' if no suitable frontend is found
)"); )");
fem.def("__repr__", [](const ov::frontend::FrontEndManager& self) -> std::string { fem.def("__repr__", [](const ov::frontend::FrontEndManager& self) -> std::string {

View File

@ -21,10 +21,8 @@ void regclass_frontend_Place(py::module m) {
R"( R"(
Returns true if this place is input for a model. Returns true if this place is input for a model.
Returns :return: True if this place is input for a model
---------- :rtype: bool
is_input : bool
True if this place is input for a model
)"); )");
place.def("is_output", place.def("is_output",
@ -32,10 +30,8 @@ void regclass_frontend_Place(py::module m) {
R"( R"(
Returns true if this place is output for a model. Returns true if this place is output for a model.
Returns :return: True if this place is output for a model.
---------- :rtype: bool
is_output : bool
True if this place is output for a model.
)"); )");
place.def("get_names", place.def("get_names",
@ -43,11 +39,9 @@ void regclass_frontend_Place(py::module m) {
R"( R"(
All associated names (synonyms) that identify this place in the graph in a framework specific way. All associated names (synonyms) that identify this place in the graph in a framework specific way.
Returns :return: A vector of strings each representing a name that identifies this place in the graph.
---------- Can be empty if there are no names associated with this place or name cannot be attached.
get_names : List[str] :rtype: List[str]
A vector of strings each representing a name that identifies this place in the graph.
Can be empty if there are no names associated with this place or name cannot be attached.
)"); )");
place.def("is_equal", place.def("is_equal",
@ -56,15 +50,10 @@ void regclass_frontend_Place(py::module m) {
R"( R"(
Returns true if another place is the same as this place. Returns true if another place is the same as this place.
Parameters :param other: Another place object.
---------- :type other: openvino.frontend.Place
other : Place :return: True if another place is the same as this place.
Another place object. :rtype: bool
Returns
----------
is_equal : bool
True if another place is the same as this place.
)"); )");
place.def("is_equal_data", place.def("is_equal_data",
@ -75,15 +64,10 @@ void regclass_frontend_Place(py::module m) {
Note: The same data means all places on path: Note: The same data means all places on path:
output port -> output edge -> tensor -> input edge -> input port. output port -> output edge -> tensor -> input edge -> input port.
Parameters :param other: Another place object.
---------- :type other: openvino.frontend.Place
other : Place :return: True if another place points to the same data.
Another place object. :rtype: bool
Returns
----------
is_equal_data : bool
True if another place points to the same data.
)"); )");
place.def( place.def(
@ -110,18 +94,13 @@ void regclass_frontend_Place(py::module m) {
Returns references to all operation nodes that consume data from this place for specified output port. Returns references to all operation nodes that consume data from this place for specified output port.
Note: It can be called for any kind of graph place searching for the first consuming operations. Note: It can be called for any kind of graph place searching for the first consuming operations.
Parameters :param output_name: Name of output port group. May not be set if node has one output port group.
---------- :type output_name: str
output_name : str :param output_port_index: If place is an operational node it specifies which output port should be considered
Name of output port group. May not be set if node has one output port group.
output_port_index : int
If place is an operational node it specifies which output port should be considered
May not be set if node has only one output port. May not be set if node has only one output port.
:type output_port_index: int
Returns :return: A list with all operation node references that consumes data from this place
---------- :rtype: List[openvino.frontend.Place]
get_consuming_operations : List[Place]
A list with all operation node references that consumes data from this place
)"); )");
place.def( place.def(
@ -147,18 +126,13 @@ void regclass_frontend_Place(py::module m) {
Returns a tensor place that gets data from this place; applicable for operations, Returns a tensor place that gets data from this place; applicable for operations,
output ports and output edges. output ports and output edges.
Parameters :param output_name: Name of output port group. May not be set if node has one output port group.
---------- :type output_name: str
output_name : str :param output_port_index: Output port index if the current place is an operation node and has multiple output ports.
Name of output port group. May not be set if node has one output port group.
output_port_index : int
Output port index if the current place is an operation node and has multiple output ports.
May not be set if place has only one output port. May not be set if place has only one output port.
:type output_port_index: int
Returns :return: A tensor place which hold the resulting value for this place.
---------- :rtype: openvino.frontend.Place
get_consuming_operations : Place
A tensor place which hold the resulting value for this place.
)"); )");
place.def( place.def(
@ -184,18 +158,13 @@ void regclass_frontend_Place(py::module m) {
R"( R"(
Get an operation node place that immediately produces data for this place. Get an operation node place that immediately produces data for this place.
Parameters :param input_name: Name of port group. May not be set if node has one input port group.
---------- :type input_name: str
input_name : str :param input_port_index: If a given place is itself an operation node, this specifies a port index.
Name of port group. May not be set if node has one input port group.
input_port_index : int
If a given place is itself an operation node, this specifies a port index.
May not be set if place has only one input port. May not be set if place has only one input port.
:type input_port_index: int
Returns :return: An operation place that produces data for this place.
---------- :rtype: openvino.frontend.Place
get_producing_operation : Place
An operation place that produces data for this place.
)"); )");
place.def("get_producing_port", place.def("get_producing_port",
@ -203,10 +172,8 @@ void regclass_frontend_Place(py::module m) {
R"( R"(
Returns a port that produces data for this place. Returns a port that produces data for this place.
Returns :return: A port place that produces data for this place.
---------- :rtype: openvino.frontend.Place
get_producing_port : Place
A port place that produces data for this place.
)"); )");
place.def( place.def(
@ -231,18 +198,12 @@ void regclass_frontend_Place(py::module m) {
R"( R"(
For operation node returns reference to an input port with specified name and index. For operation node returns reference to an input port with specified name and index.
Parameters :param input_name: Name of port group. May not be set if node has one input port group.
---------- :type input_name: str
input_name : str :param input_port_index: Input port index in a group. May not be set if node has one input port in a group.
Name of port group. May not be set if node has one input port group. :type input_port_index: int
:return: Appropriate input port place.
input_port_index : int :rtype: openvino.frontend.Place
Input port index in a group. May not be set if node has one input port in a group.
Returns
----------
get_input_port : Place
Appropriate input port place.
)"); )");
place.def( place.def(
@ -267,18 +228,12 @@ void regclass_frontend_Place(py::module m) {
R"( R"(
For operation node returns reference to an output port with specified name and index. For operation node returns reference to an output port with specified name and index.
Parameters :param output_name: Name of output port group. May not be set if node has one output port group.
---------- :type output_name: str
output_name : str :param output_port_index: Output port index. May not be set if node has one output port in a group.
Name of output port group. May not be set if node has one output port group. :type output_port_index: int
:return: Appropriate output port place.
output_port_index : int :rtype: openvino.frontend.Place
Output port index. May not be set if node has one output port in a group.
Returns
----------
get_output_port : Place
Appropriate output port place.
)"); )");
place.def("get_consuming_ports", place.def("get_consuming_ports",
@ -286,10 +241,8 @@ void regclass_frontend_Place(py::module m) {
R"( R"(
Returns all input ports that consume data flows through this place. Returns all input ports that consume data flows through this place.
Returns :return: Input ports that consume data flows through this place.
---------- :rtype: List[openvino.frontend.Place]
get_consuming_ports : List[Place]
Input ports that consume data flows through this place.
)"); )");
place.def( place.def(
@ -315,16 +268,11 @@ void regclass_frontend_Place(py::module m) {
Returns a tensor place that supplies data for this place; applicable for operations, Returns a tensor place that supplies data for this place; applicable for operations,
input ports and input edges. input ports and input edges.
Parameters :param input_name : Name of port group. May not be set if node has one input port group.
---------- :type input_name: str
input_name : str :param input_port_index: Input port index for operational node. May not be specified if place has only one input port.
Name of port group. May not be set if node has one input port group. :type input_port_index: int
input_port_index : int :return: A tensor place which supplies data for this place.
Input port index for operational node. May not be specified if place has only one input port. :rtype: openvino.frontend.Place
Returns
----------
get_source_tensor : Place
A tensor place which supplies data for this place.
)"); )");
} }

View File

@ -27,10 +27,8 @@ void regclass_graph_descriptor_Tensor(py::module m) {
R"( R"(
Returns the shape description. Returns the shape description.
Returns :return: The shape description.
---------- :rtype: openvino.runtime.Shape
get_shape : Shape
The shape description.
)"); )");
tensor.def("get_rt_info", tensor.def("get_rt_info",
@ -39,66 +37,54 @@ void regclass_graph_descriptor_Tensor(py::module m) {
R"( R"(
Returns PyRTMap which is a dictionary of user defined runtime info. Returns PyRTMap which is a dictionary of user defined runtime info.
Returns :return: A dictionary of user defined data.
---------- :rtype: openvino.runtime.RTMap
get_rt_info : PyRTMap
A dictionary of user defined data.
)"); )");
tensor.def("size", tensor.def("size",
&ov::descriptor::Tensor::size, &ov::descriptor::Tensor::size,
R"( R"(
Returns the size description Returns the size description.
Returns :return: The size description.
---------- :rtype: size_t
size : size_t
The size description.
)"); )");
tensor.def("get_partial_shape", tensor.def("get_partial_shape",
&ov::descriptor::Tensor::get_partial_shape, &ov::descriptor::Tensor::get_partial_shape,
R"( R"(
Returns the partial shape description Returns the partial shape description.
Returns :return: PartialShape description.
---------- :rtype: openvino.runtime.PartialShape
get_partial_shape : PartialShape
PartialShape description.
)"); )");
tensor.def("get_element_type", tensor.def("get_element_type",
&ov::descriptor::Tensor::get_element_type, &ov::descriptor::Tensor::get_element_type,
R"( R"(
Returns the element type description Returns the element type description.
Returns :return: Type description.
---------- :rtype: openvino.runtime.Type
get_element_type : Type
Type description
)"); )");
tensor.def("get_names", tensor.def("get_names",
&ov::descriptor::Tensor::get_names, &ov::descriptor::Tensor::get_names,
R"( R"(
Returns names Returns names.
Returns :return: Get names.
---------- :rtype: set
get_names : set
Set of names
)"); )");
tensor.def("set_names", tensor.def("set_names",
&ov::descriptor::Tensor::set_names, &ov::descriptor::Tensor::set_names,
py::arg("names"), py::arg("names"),
R"( R"(
Set names for tensor Set names for tensor.
Parameters :param names: Set of names.
---------- :type names: set
names : set
Set of names
)"); )");
tensor.def("add_names", tensor.def("add_names",
@ -107,21 +93,17 @@ void regclass_graph_descriptor_Tensor(py::module m) {
R"( R"(
Adds names for tensor. Adds names for tensor.
Parameters :param names: Add names.
---------- :type names: set
names : set
Set of names
)"); )");
tensor.def("get_any_name", tensor.def("get_any_name",
&ov::descriptor::Tensor::get_any_name, &ov::descriptor::Tensor::get_any_name,
R"( R"(
Returns any of set name Returns any of set name.
Returns :return: Any name.
---------- :rtype: string
get_any_name : string
Any name
)"); )");
tensor.def_property_readonly("shape", &ov::descriptor::Tensor::get_shape); tensor.def_property_readonly("shape", &ov::descriptor::Tensor::get_shape);

View File

@ -24,60 +24,48 @@ void regclass_graph_Input(py::module m) {
R"( R"(
Get node referenced by this input handle. Get node referenced by this input handle.
Returns :return: Node object referenced by this input handle.
---------- :rtype: openvino.runtime.Node
get_node : Node
Node object referenced by this input handle.
)"); )");
input.def("get_index", input.def("get_index",
&ov::Input<ov::Node>::get_index, &ov::Input<ov::Node>::get_index,
R"( R"(
The index of the input referred to by this input handle. The index of the input referred to by this input handle.
Returns :return: Index value as integer.
---------- :rtype: int
get_index : int
Index value as integer.
)"); )");
input.def("get_element_type", input.def("get_element_type",
&ov::Input<ov::Node>::get_element_type, &ov::Input<ov::Node>::get_element_type,
R"( R"(
The element type of the input referred to by this input handle. The element type of the input referred to by this input handle.
Returns :return: Type of the input.
---------- :rtype: openvino.runtime.Type
get_element_type : Type
Type of the input.
)"); )");
input.def("get_shape", input.def("get_shape",
&ov::Input<ov::Node>::get_shape, &ov::Input<ov::Node>::get_shape,
R"( R"(
The shape of the input referred to by this input handle. The shape of the input referred to by this input handle.
Returns :return: Shape of the input.
---------- :rtype: openvino.runtime.Shape
get_shape : Shape
Shape of the input.
)"); )");
input.def("get_partial_shape", input.def("get_partial_shape",
&ov::Input<ov::Node>::get_partial_shape, &ov::Input<ov::Node>::get_partial_shape,
R"( R"(
The partial shape of the input referred to by this input handle. The partial shape of the input referred to by this input handle.
Returns :return: PartialShape of the input.
---------- :rtype: openvino.runtime.PartialShape
get_partial_shape : PartialShape
PartialShape of the input.
)"); )");
input.def("get_source_output", input.def("get_source_output",
&ov::Input<ov::Node>::get_source_output, &ov::Input<ov::Node>::get_source_output,
R"( R"(
A handle to the output that is connected to this input. A handle to the output that is connected to this input.
Returns :return: Output that is connected to the input.
---------- :rtype: openvino.runtime.Output
get_source_output : Output
Output that is connected to the input.
)"); )");
input.def("get_rt_info", input.def("get_rt_info",
@ -86,10 +74,8 @@ void regclass_graph_Input(py::module m) {
R"( R"(
Returns RTMap which is a dictionary of user defined runtime info. Returns RTMap which is a dictionary of user defined runtime info.
Returns :return: A dictionary of user defined data.
---------- :rtype: openvino.runtime.RTMap
get_rt_info : RTMap
A dictionary of user defined data.
)"); )");
input.def_property_readonly("rt_info", (ov::RTMap & (ov::Input<ov::Node>::*)()) & ov::Input<ov::Node>::get_rt_info); input.def_property_readonly("rt_info", (ov::RTMap & (ov::Input<ov::Node>::*)()) & ov::Input<ov::Node>::get_rt_info);
input.def_property_readonly("rt_info", input.def_property_readonly("rt_info",

View File

@ -76,10 +76,9 @@ void regclass_graph_passes_Manager(py::module m) {
py::arg("pass_name"), py::arg("pass_name"),
R"( R"(
Set the type of register pass for pass manager. Set the type of register pass for pass manager.
Parameters
---------- :param pass_name : String to set the type of a pass.
pass_name : str :type pass_name: str
string to set the type of a pass
// )"); // )");
manager.def("register_pass", manager.def("register_pass",
@ -90,18 +89,17 @@ void regclass_graph_passes_Manager(py::module m) {
py::arg("version") = "UNSPECIFIED", py::arg("version") = "UNSPECIFIED",
R"( R"(
Set the type of register pass for pass manager. Set the type of register pass for pass manager.
Parameters
---------- :param pass_name: String to set the type of a pass.
pass_name : str :type pass_name: str
string to set the type of a pass :param output_files: Tuple which contains paths where .xml and .bin files will be saved.
output_files : Tuple[str, str] :type output_files: Tuple[str, str]
tuple which contains paths where .xml and .bin files will be saved :param version: Sets the version of the IR which will be generated.
version : str Supported versions are:
sets the version of the IR which will be generated. - "UNSPECIFIED" (default) : Use the latest or function version
Supported versions are: - "IR_V10" : v10 IR
- "UNSPECIFIED" (default) : Use the latest or function version - "IR_V11" : v11 IR
- "IR_V10" : v10 IR :type version: str
- "IR_V11" : v11 IR
Examples Examples
---------- ----------
1. Default Version 1. Default Version
@ -121,20 +119,19 @@ void regclass_graph_passes_Manager(py::module m) {
py::arg("version") = "UNSPECIFIED", py::arg("version") = "UNSPECIFIED",
R"( R"(
Set the type of register pass for pass manager. Set the type of register pass for pass manager.
Parameters
---------- :param pass_name: String to set the type of a pass.
pass_name : str :type pass_name: str
string to set the type of a pass :param xml_path: Path where *.xml file will be saved.
xml_path : str :type xml_path: str
path where .xml file will be saved :param bin_path: Path where *.bin file will be saved.
bin_path : str :type bin_path: str
path where .bin file will be saved :param version: Sets the version of the IR which will be generated.
version : str
sets the version of the IR which will be generated.
Supported versions are: Supported versions are:
- "UNSPECIFIED" (default) : Use the latest or function version - "UNSPECIFIED" (default) : Use the latest or function version
- "IR_V10" : v10 IR - "IR_V10" : v10 IR
- "IR_V11" : v11 IR - "IR_V11" : v11 IR
:type version: str
Examples Examples
---------- ----------
1. Default Version 1. Default Version

View File

@ -33,15 +33,10 @@ static void regclass_graph_PreProcessSteps(py::module m) {
Subtracts single float value from each element in input tensor. Subtracts single float value from each element in input tensor.
Input tensor must have ov.Type.f32 data type. Input tensor must have ov.Type.f32 data type.
Parameters :param value: Value to subtract.
---------- :type value: float
value : float :return: Reference to itself to allow chaining of calls in client's code in a builder-like manner.
Value to subtract. :rtype: openvino.runtime.preprocess.PreProcessSteps
Returns
----------
selfan : PreProcessSteps
Reference to itself to allow chaining of calls in client's code in a builder-like manner.
)"); )");
steps.def( steps.def(
@ -54,15 +49,10 @@ static void regclass_graph_PreProcessSteps(py::module m) {
Subtracts a given single float value from each element in a given channel from input tensor. Subtracts a given single float value from each element in a given channel from input tensor.
Input tensor must have ov.Type.f32 data type. Input tensor must have ov.Type.f32 data type.
Parameters :param values: Values to subtract.
---------- :type values: List[float]
values : List[float] :return: Reference to itself to allow chaining of calls in client's code in a builder-like manner.
Values to subtract. :rtype: openvino.runtime.preprocess.PreProcessSteps
Returns
----------
selfan : PreProcessSteps
Reference to itself to allow chaining of calls in client's code in a builder-like manner.
)"); )");
steps.def( steps.def(
@ -75,15 +65,10 @@ static void regclass_graph_PreProcessSteps(py::module m) {
Divides each element in input tensor by specified constant float value. Divides each element in input tensor by specified constant float value.
Input tensor must have ov.Type.f32 data type. Input tensor must have ov.Type.f32 data type.
Parameters :param value: Value used in division.
---------- :type value: float
value : float :return: Reference to itself to allow chaining of calls in client's code in a builder-like manner.
Value to divide. :rtype: openvino.runtime.preprocess.PreProcessSteps
Returns
----------
scale : PreProcessSteps
Reference to itself to allow chaining of calls in client's code in a builder-like manner.
)"); )");
steps.def( steps.def(
@ -96,15 +81,10 @@ static void regclass_graph_PreProcessSteps(py::module m) {
Divides each element in a given channel from input tensor by a given single float value. Divides each element in a given channel from input tensor by a given single float value.
Input tensor must have ov.Type.f32 data type. Input tensor must have ov.Type.f32 data type.
Parameters :param values: Values which are used in division.
---------- :type values: List[float]
value : List[float] :return: Reference to itself to allow chaining of calls in client's code in a builder-like manner.
Value to divide. :rtype: openvino.runtime.preprocess.PreProcessSteps
Returns
----------
scale : PreProcessSteps
Reference to itself to allow chaining of calls in client's code in a builder-like manner.
)"); )");
steps.def( steps.def(
@ -117,15 +97,10 @@ static void regclass_graph_PreProcessSteps(py::module m) {
Converts input tensor element type to specified type. Converts input tensor element type to specified type.
Input tensor must have openvino.Type data type. Input tensor must have openvino.Type data type.
Parameters :param type: Destination type. If not specified, type will be taken from model input's element type
---------- :type type: openvino.runtime.Type
type : openvino.runtime.Type :return: Reference to itself to allow chaining of calls in client's code in a builder-like manner.
Destination type. If not specified, type will be taken from model input's element type. :rtype: openvino.runtime.preprocess.PreProcessSteps
Returns
----------
convert_element_type : PreProcessSteps
Reference to itself to allow chaining of calls in client's code in a builder-like manner.
)"); )");
steps.def( steps.def(
@ -137,14 +112,10 @@ static void regclass_graph_PreProcessSteps(py::module m) {
R"( R"(
Adds custom preprocessing operation. Adds custom preprocessing operation.
Parameters :param operation: Python's function which takes `openvino.runtime.Output` as input argument and returns`openvino.runtime.Output`.
---------- :type operation: function
operation : function taking Output<Node> as input argument and returning Output<Node> after preprocessing. :return: Reference to itself, allows chaining of calls in client's code in a builder-like manner.
:rtype: openvino.runtime.preprocess.PreProcessSteps
Returns
----------
custom : PreProcessSteps
Reference to itself to allow chaining of calls in client's code in a builder-like manner.
)"); )");
steps.def( steps.def(
@ -208,15 +179,10 @@ static void regclass_graph_PostProcessSteps(py::module m) {
Converts tensor element type to specified type. Converts tensor element type to specified type.
Tensor must have openvino.Type data type. Tensor must have openvino.Type data type.
Parameters :param type: Destination type. If not specified, type will be taken from model output's element type.
---------- :type type: openvino.runtime.Type
type : Type :return: Reference to itself to allow chaining of calls in client's code in a builder-like manner.
Destination type. If not specified, type will be taken from model output's element type. :rtype: openvino.runtime.preprocess.PostProcessSteps
Returns
----------
convert_element_type : PostProcessSteps
Reference to itself to allow chaining of calls in client's code in a builder-like manner.
)"); )");
steps.def( steps.def(
@ -242,14 +208,10 @@ static void regclass_graph_PostProcessSteps(py::module m) {
R"( R"(
Adds custom postprocessing operation. Adds custom postprocessing operation.
Parameters :param operation: Python's function which takes `openvino.runtime.Output` as input argument and returns`openvino.runtime.Output`.
---------- :type operation: function
operation : function taking Output<Node> as input argument and returning Output<Node> after postprocessing. :return: Reference to itself, allows chaining of calls in client's code in a builder-like manner.
:rtype: openvino.runtime.preprocess.PreProcessSteps
Returns
----------
custom : PostProcessSteps
Reference to itself to allow chaining of calls in client's code in a builder-like manner.
)"); )");
} }
@ -269,15 +231,10 @@ static void regclass_graph_InputTensorInfo(py::module m) {
Set initial client's tensor element type. If type is not the same as model's element type, Set initial client's tensor element type. If type is not the same as model's element type,
conversion of element type will be done automatically. conversion of element type will be done automatically.
Parameters :param type: Client's input tensor element type.
---------- :type type: openvino.runtime.Type
type : Type :return: Reference to itself, allows chaining of calls in client's code in a builder-like manner.
Client's input tensor element type. :rtype: openvino.runtime.preprocess.InputTensorInfo
Returns
----------
tensor : InputTensorInfo
Reference to itself to allow chaining of calls in client's code in a builder-like manner.
)"); )");
info.def( info.def(
@ -347,14 +304,11 @@ static void regclass_graph_OutputTensorInfo(py::module m) {
R"( R"(
Set client's output tensor element type. If type is not the same as model's element type, Set client's output tensor element type. If type is not the same as model's element type,
conversion of element type will be done automatically. conversion of element type will be done automatically.
Parameters
---------- :param type: Client's output tensor element type.
type : Type :type type: openvino.runtime.Type
Client's output tensor element type. :return: Reference to itself to allow chaining of calls in client's code in a builder-like manner.
Returns :rtype: openvino.runtime.preprocess.OutputTensorInfo
----------
tensor : OutputTensorInfo
Reference to itself to allow chaining of calls in client's code in a builder-like manner.
)"); )");
info.def( info.def(

View File

@ -92,7 +92,7 @@ def test_convert_partially():
func = fe.convert_partially(model=model) func = fe.convert_partially(model=model)
stat = get_fe_stat() stat = get_fe_stat()
assert stat.convert_partially == 1 assert stat.convert_partially == 1
fe.convert(function=func) fe.convert(model=func)
stat = get_fe_stat() stat = get_fe_stat()
assert stat.convert == 1 assert stat.convert == 1
@ -106,7 +106,7 @@ def test_decode_and_normalize():
func = fe.decode(model=model) func = fe.decode(model=model)
stat = get_fe_stat() stat = get_fe_stat()
assert stat.decode == 1 assert stat.decode == 1
fe.normalize(function=func) fe.normalize(model=func)
stat = get_fe_stat() stat = get_fe_stat()
assert stat.normalize == 1 assert stat.normalize == 1
assert stat.decode == 1 assert stat.decode == 1