class ngraph::op::TypeRelaxedBase

Overview

A base class for templated TypeRelaxed that maintains overridden input types and output types for an operation. More…

#include <type_relaxed.hpp>

class TypeRelaxedBase
{
public:
    // structs

    struct init_rt_result;

    // construction

    TypeRelaxedBase(
        const element::TypeVector& _input_data_types = {},
        const element::TypeVector& _output_data_types = {}
        );

    // methods

    const element::Type& get_overridden_output_type(size_t outputIndex = 0) const;

    void set_overridden_output_type(
        const element::Type& element_type,
        size_t outputIndex = 0
        );

    const element::Type& get_origin_input_type(size_t inputIndex = 0) const;

    void set_origin_input_type(
        const element::Type& element_type,
        size_t inputIndex = 0
        );
};

// direct descendants

template <typename BaseOp>
class TypeRelaxed;

Detailed Documentation

A base class for templated TypeRelaxed that maintains overridden input types and output types for an operation.

Methods

const element::Type& get_overridden_output_type(size_t outputIndex = 0) const

This method may look similar to Node::get_output_element_type, but it is not the same thing, because get_output_element_type returns the result of type inference, so it is completely deduced from an operation inputs and attributes, and get_overridden_output_type returns value of the attribute that is used to deduce output type. In some cases they don’t match: get_overridden_output_type may return element::undefined for some index i, and get_output_element_type will return some real type for the same index i.

Returns:

Data type that will be set for output with a given index outputIndex. If output with a specified index outputIndex hasn’t been set before, element::undefined will returned. Undefined means no type override happens for a given outputIndex and it will deduced as original operation defineds in its infer function.

void set_overridden_output_type(
    const element::Type& element_type,
    size_t outputIndex = 0
    )

Set data type that overrides the original data type for output port with outputIndex index In case if outputIndex is out of range of known outputs (and this class cannot detect the real number of outputs for original operation), the number of overridden outputs is changed according to a given outputIndex value.

const element::Type& get_origin_input_type(size_t inputIndex = 0) const

Returns:

Data type that will be set for input when original shape/type inference function is called. If index inputIndex hasn’t been set before, element::undefined will returned. Undefined means that the type from input tensor descriptor is used for a given index.

void set_origin_input_type(
    const element::Type& element_type,
    size_t inputIndex = 0
    )

Set data type that overrides the original data type for input port with inputIndex index. In case if inputIndex is out of range of known inputs (and this class cannot detect the real number of inputs for original operation), the number of overridden inputs is changed according to a given inputIndex value. All new entries except one added at inputIndex position are undefined.