A type id is a unique id for a given C++ type. More...
#include <typeid.h>
Static Public Member Functions | |
static TypeIdentifier | createTypeId () |
static constexpr TypeIdentifier | uninitialized () |
template<typename T > | |
static C10_API TypeIdentifier | Get () |
Returns the unique id for the given type T. More... | |
Friends | |
class | TypeMeta |
std::ostream & | operator<< (std::ostream &stream, TypeIdentifier typeId) |
bool | operator< (TypeIdentifier lhs, TypeIdentifier rhs) |
Additional Inherited Members | |
Public Types inherited from c10::IdWrapper< TypeIdentifier, uint16_t > | |
using | underlying_type = uint16_t |
using | concrete_type = TypeIdentifier |
Protected Member Functions inherited from c10::IdWrapper< TypeIdentifier, uint16_t > | |
constexpr | IdWrapper (underlying_type id) noexcept(noexcept(underlying_type(std::declval< underlying_type >()))) |
constexpr underlying_type | underlyingId () const noexcept(noexcept(underlying_type(std::declval< underlying_type >()))) |
A type id is a unique id for a given C++ type.
You need to register your types using CAFFE_KNOWN_TYPE(MyType) to be able to use TypeIdentifier with custom types. This is for example used to store the dtype of tensors.
|
static |
Returns the unique id for the given type T.
The id is unique for the type T in the sense that for any two different types, their ids are different; for the same type T, the id remains the same over different calls of the function. However, this is not guaranteed over different runs, as the id is generated during run-time. Do NOT serialize the id for storage.