class ov::element::Type

Overview

Base class to define element type. More…

#include <element_type.hpp>

class Type
{
public:
    // construction

    Type();
    Type(const Type&);
    Type(const Type_t t);

    Type(
        size_t bitwidth,
        bool is_real,
        bool is_signed,
        bool is_quantized,
        const std::string& cname
        );

    // methods

    Type& operator = (const Type&);
    std::string c_type_string() const;
    size_t size() const;
    size_t hash() const;
    bool is_static() const;
    bool is_dynamic() const;
    bool is_real() const;
    bool is_integral() const;
    bool is_integral_number() const;
    bool is_signed() const;
    bool is_quantized() const;
    size_t bitwidth() const;
    std::string get_type_name() const;
    bool compatible(const element::Type& t) const;
    constexpr operator Type_t () const;
    static std::vector<const Type \*> get_known_types();

    static bool merge(
        element::Type& dst,
        const element::Type& t1,
        const element::Type& t2
        );
};

Detailed Documentation

Base class to define element type.

Methods

bool compatible(const element::Type& t) const

Checks whether this element type is merge-compatible with t.

Parameters:

t

The element type to compare this element type to.

Returns:

true if this element type is compatible with t, else false.

static bool merge(
    element::Type& dst,
    const element::Type& t1,
    const element::Type& t2
    )

Merges two element types t1 and t2, writing the result into dst and returning true if successful, else returning false.

To “merge” two element types t1 and t2 is to find the least restrictive element type t that is no more restrictive than t1 and t2, if t exists. More simply:

merge(dst,element::Type::dynamic,t) writes t to dst and returns true

merge(dst,t,element::Type::dynamic) writes t to dst and returns true

merge(dst,t1,t2) where t1, t2 both static and equal writes t1 to dst and returns true

merge(dst,t1,t2) where t1, t2 both static and unequal does nothing to dst, and returns false