class ov::frontend::Place

Overview

An interface for identifying a place in a graph and iterate over it; can refer to an operation node, tensor, port etc. More…

#include <place.hpp>

class Place
{
public:
    // typedefs

    typedef std::shared_ptr<Place> Ptr;

    // methods

    virtual std::vector<std::string> get_names() const;
    virtual std::vector<Ptr> get_consuming_operations() const;
    virtual std::vector<Ptr> get_consuming_operations(int output_port_index) const;
    virtual std::vector<Ptr> get_consuming_operations(const std::string& outputName) const;

    virtual std::vector<Ptr> get_consuming_operations(
        const std::string& outputName,
        int outputPortIndex
        ) const;

    virtual Ptr get_target_tensor() const;
    virtual Ptr get_target_tensor(const std::string& outputName) const;

    virtual Ptr get_target_tensor(
        const std::string& outputName,
        int outputPortIndex
        ) const;

    virtual Ptr get_target_tensor(int output_port_index) const;
    virtual Ptr get_source_tensor() const;
    virtual Ptr get_source_tensor(int input_port_index) const;
    virtual Ptr get_source_tensor(const std::string& inputName) const;
    virtual Ptr get_source_tensor(const std::string& inputName, int inputPortIndex) const;
    virtual Ptr get_producing_operation() const;
    virtual Ptr get_producing_operation(int input_port_index) const;
    virtual Ptr get_producing_operation(const std::string& inputName) const;

    virtual Ptr get_producing_operation(
        const std::string& inputName,
        int inputPortIndex
        ) const;

    virtual Ptr get_producing_port() const;
    virtual Ptr get_input_port() const;
    virtual Ptr get_input_port(int input_port_index) const;
    virtual Ptr get_input_port(const std::string& input_name) const;
    virtual Ptr get_input_port(const std::string& input_name, int input_port_index) const;
    virtual Ptr get_output_port() const;
    virtual Ptr get_output_port(int output_port_index) const;
    virtual Ptr get_output_port(const std::string& output_name) const;

    virtual Ptr get_output_port(
        const std::string& output_name,
        int output_port_index
        ) const;

    virtual std::vector<Place::Ptr> get_consuming_ports() const;
    virtual bool is_input() const;
    virtual bool is_output() const;
    virtual bool is_equal(const Ptr& another) const;
    virtual bool is_equal_data(const Ptr& another) const;
};

Detailed Documentation

An interface for identifying a place in a graph and iterate over it; can refer to an operation node, tensor, port etc.

Each front end implementation provides specialization of this interface to represent a place in a model graph. Various methods in the front end classes accept and retrieve instances of Place to point to particular node part which should be modified or satisfies some criteria. For example, this class is used to report model inputs and outputs, for searching operations and tensors by name, for setting shape etc.

Place can refer to Tensor, Input Edge, Input Port, Operation, Output Port, Output Edge

     [Tensor A]
         |
         | [Input Edge]
         |
         V
-------------------
[  [Input Port 0] ]
[                 ]
[   Operation A   ]
[                 ]
[ [Output Port 0] ]
-------------------
         |
         | [Output Edge]
         |
         V
     [Tensor B]
         |
         | [Input Edge]
         |
         V
-------------------
[  [Input Port 0] ]
[                 ]
[   Operation B   ]
[                 ]
[ [Output Port 0] ]
-------------------
         |
         | [Output Edge]
         |
         V
     [Tensor C]

Methods

virtual std::vector<std::string> get_names() const

All associated names (synonyms) that identify this place in the graph in a framework specific way.

Returns:

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.

virtual std::vector<Ptr> get_consuming_operations() const

Returns references to all operation nodes that consume data from this place.

It can be called for any kind of graph place searching for the first consuming operations. It is optional if place has only one output port

Returns:

A vector with all operation node references that consumes data from this place

virtual std::vector<Ptr> get_consuming_operations(int output_port_index) const

Returns references to all operation nodes that consume data from this place for specified output port.

It can be called for any kind of graph place searching for the first consuming operations.

Parameters:

output_port_index

If place is an operational node it specifies which output port should be considered.

Returns:

A vector with all operation node references that consumes data from this place

virtual std::vector<Ptr> get_consuming_operations(const std::string& outputName) const

Returns references to all operation nodes that consume data from this place for specified output port.

It can be called for any kind of graph place searching for the first consuming operations.

Parameters:

outputName

If a given place is itself an operation node, this specifies name of output port group

Returns:

A vector with all operation node references that consumes data from this place

virtual std::vector<Ptr> get_consuming_operations(
    const std::string& outputName,
    int outputPortIndex
    ) const

Returns references to all operation nodes that consume data from this place for specified output port.

It can be called for any kind of graph place searching for the first consuming operations.

Parameters:

outputName

If a given place is itself an operation node, this specifies name of output port group, each group can have multiple ports

outputPortIndex

If place is an operational node it specifies which output port should be considered.

Returns:

A vector with all operation node references that consumes data from this place

virtual Ptr get_target_tensor() const

Returns a tensor place that gets data from this place; applicable for operations, output ports and output edges which have only one output port.

Returns:

A tensor place which hold the resulting value for this place

virtual Ptr get_target_tensor(const std::string& outputName) const

Returns a tensor place that gets data from this place; applicable for operations.

Parameters:

outputName

Name of output port group

Returns:

A tensor place which hold the resulting value for this place

virtual Ptr get_target_tensor(
    const std::string& outputName,
    int outputPortIndex
    ) const

Returns a tensor place that gets data from this place; applicable for operations.

Parameters:

outputName

Name of output port group, each group can have multiple ports

outputPortIndex

Output port index if the current place is an operation node and has multiple output ports

Returns:

A tensor place which hold the resulting value for this place

virtual Ptr get_target_tensor(int output_port_index) const

Returns a tensor place that gets data from this place; applicable for operations.

Parameters:

output_port_index

Output port index if the current place is an operation node and has multiple output ports

Returns:

A tensor place which hold the resulting value for this place

virtual Ptr get_source_tensor() const

Returns a tensor place that supplies data for this place; applicable for operations, input ports and input edges which have only one input port.

Returns:

A tensor place which supplies data for this place

virtual Ptr get_source_tensor(int input_port_index) const

Returns a tensor place that supplies data for this place; applicable for operations.

Parameters:

input_port_index

Input port index for operational nodes.

Returns:

A tensor place which supplies data for this place

virtual Ptr get_source_tensor(const std::string& inputName) const

Returns a tensor place that supplies data for this place; applicable for operations.

Parameters:

inputName

Name of input port group

Returns:

A tensor place which supplies data for this place

virtual Ptr get_source_tensor(const std::string& inputName, int inputPortIndex) const

Returns a tensor place that supplies data for this place; applicable for operations.

Parameters:

inputName

If a given place is itself an operation node, this specifies name of output port group, each group can have multiple ports

inputPortIndex

Input port index for operational nodes.

Returns:

A tensor place which supplies data for this place

virtual Ptr get_producing_operation() const

Get an operation node place that immediately produces data for this place; applicable if place has only one input port.

Returns:

An operation place that produces data for this place

virtual Ptr get_producing_operation(int input_port_index) const

Get an operation node place that immediately produces data for this place.

Parameters:

input_port_index

If a given place is itself an operation node, this specifies a port index

Returns:

An operation place that produces data for this place

virtual Ptr get_producing_operation(const std::string& inputName) const

Get an operation node place that immediately produces data for this place.

Parameters:

inputName

If a given place is itself an operation node, this specifies name of output port group

Returns:

An operation place that produces data for this place

virtual Ptr get_producing_operation(
    const std::string& inputName,
    int inputPortIndex
    ) const

Get an operation node place that immediately produces data for this place.

Parameters:

inputName

If a given place is itself an operation node, this specifies name of output port group, each group can have multiple ports

inputPortIndex

If a given place is itself an operation node, this specifies a port index

Returns:

An operation place that produces data for this place

virtual Ptr get_producing_port() const

Returns a port that produces data for this place.

virtual Ptr get_input_port() const

For operation node returns reference to an input port; applicable if operation node has only one input port.

Returns:

Input port place or nullptr if not exists

virtual Ptr get_input_port(int input_port_index) const

For operation node returns reference to an input port with specified index.

Parameters:

input_port_index

Input port index

Returns:

Appropriate input port place or nullptr if not exists

virtual Ptr get_input_port(const std::string& input_name) const

For operation node returns reference to an input port with specified name; applicable if port group has only one input port.

Parameters:

input_name

Name of port group

Returns:

Appropriate input port place or nullptr if not exists

virtual Ptr get_input_port(const std::string& input_name, int input_port_index) const

For operation node returns reference to an input port with specified name and index.

Parameters:

input_name

Name of port group, each group can have multiple ports

input_port_index

Input port index in a group

Returns:

Appropriate input port place or nullptr if not exists

virtual Ptr get_output_port() const

For operation node returns reference to an output port; applicable for operations with only one output port.

Returns:

Appropriate output port place or nullptr if not exists

virtual Ptr get_output_port(int output_port_index) const

For operation node returns reference to an output port with specified index.

Parameters:

output_port_index

Output port index

Returns:

Appropriate output port place or nullptr if not exists

virtual Ptr get_output_port(const std::string& output_name) const

For operation node returns reference to an output port with specified name; applicable if port group has only one output port.

Parameters:

output_name

Name of output port group

Returns:

Appropriate output port place or nullptr if not exists

virtual Ptr get_output_port(
    const std::string& output_name,
    int output_port_index
    ) const

For operation node returns reference to an output port with specified name and index.

Parameters:

output_name

Name of output port group, each group can have multiple ports

output_port_index

Output port index

Returns:

Appropriate output port place or nullptr if not exists

virtual std::vector<Place::Ptr> get_consuming_ports() const

Returns all input ports that consume data flows through this place.

virtual bool is_input() const

Returns true if this place is input for a model.

virtual bool is_output() const

Returns true if this place is output for a model.

virtual bool is_equal(const Ptr& another) const

Returns true if another place is the same as this place.

Parameters:

another

Another place object

virtual bool is_equal_data(const Ptr& another) const

Returns true if another place points to the same data.

The same data means all places on path: output port -> output edge -> tensor -> input edge -> input port.

Parameters:

another

Another place object