class ngraph::pass::low_precision::PrecisionsRestriction

Overview

PrecisionsRestriction defines a set of precision restrictions for each input port Common precision restriction can be also set for several ports. In this case, an operation will have the same precision for mentioned. More…

#include <precisions_restriction.hpp>

class PrecisionsRestriction
{
public:
    // typedefs

    typedef std::vector<std::pair<std::vector<size_t>, std::vector<ngraph::element::Type>>> PrecisionsByPorts;
    typedef std::function<PrecisionsByPorts(const std::shared_ptr<Node>&)> PrecisionsByPortsFunction;

    // fields

    ngraph::Node::type_info_t operationType;
    bool specifyVersion;
    PrecisionsByPorts precisionsByPorts;
    PrecisionsByPortsFunction precisionsByPortsFunction;

    // construction

    PrecisionsRestriction();

    PrecisionsRestriction(
        const ngraph::Node::type_info_t& operationType,
        const bool specifyVersion,
        const PrecisionsByPorts& precisionsByPorts
        );

    PrecisionsRestriction(
        const ngraph::Node::type_info_t& operationType,
        const bool specifyVersion,
        const PrecisionsByPortsFunction& precisionsByPortsFunction
        );

    // methods

    template <typename T>
    static PrecisionsRestriction create(
        const PrecisionsByPorts& precisionsByPorts,
        const bool specifyVersion = false
        );

    template <typename T>
    static PrecisionsRestriction create(
        const PrecisionsByPortsFunction& precisionsByPortsFunction,
        const bool specifyVersion = false
        );

    template <typename T>
    static PrecisionsByPorts getPrecisionsByOperationType(std::vector<PrecisionsRestriction>& restrictions);
};

Detailed Documentation

PrecisionsRestriction defines a set of precision restrictions for each input port Common precision restriction can be also set for several ports. In this case, an operation will have the same precision for mentioned.

// One restriction for each port PrecisionsRestriction::create<ngraph::opset1::Convolution> ({ {{0}, {ngraph::element::u8}}, {{1}, {ngraph::element::i8}}, }),

// Common precision restriction for several ports: // both inputs will have the same precision PrecisionsRestriction::create<ngraph::opset5::LSTMSequence> ({ {{0, 1}, {ngraph::element::u8, ngraph::element::i8}} }),