1 #include <c10/util/typeid.h> 2 #include <c10/util/Exception.h> 14 C10_EXPORT
void _ThrowRuntimeTypeLogicError(
const string& msg) {
20 const TypeMetaData _typeMetaDataInstance_uninitialized_ =
detail::TypeMetaData(0,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr, TypeIdentifier::uninitialized(),
"nullptr (uninitialized)");
26 C10_EXPORT
const detail::TypeMetaData* TypeMeta::_typeMetaDataInstance<detail::_Uninitialized>() noexcept {
27 return &detail::_typeMetaDataInstance_uninitialized_;
32 static std::atomic<TypeIdentifier::underlying_type> counter(
33 TypeMeta::Id<_CaffeHighestPreallocatedTypeId>().underlyingId());
34 const TypeIdentifier::underlying_type new_value = ++counter;
36 std::numeric_limits<TypeIdentifier::underlying_type>::max()) {
37 throw std::logic_error(
38 "Ran out of available type ids. If you need more than 2^16 CAFFE_KNOWN_TYPEs, we need to increase TypeIdentifier to use more than 16 bit.");
43 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(0, uint8_t)
44 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(1, int8_t)
45 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(2, int16_t)
46 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(3,
int)
47 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(4, int64_t)
48 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(5,
at::Half)
49 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(6,
float)
50 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(7,
double)
52 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(9, std::complex<float>)
53 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(10, std::complex<double>)
56 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(13, std::string)
57 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(14,
bool)
58 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(15, uint16_t)
59 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(16,
char)
60 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(17, std::unique_ptr<std::mutex>)
61 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(18, std::unique_ptr<std::atomic<bool>>)
62 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(19, std::vector<int32_t>)
63 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(20, std::vector<int64_t>)
64 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(21, std::vector<unsigned long>)
65 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(22,
bool*)
66 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(23,
char*)
67 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(24,
int*)
70 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(25, detail::_guard_long_unique<long>);
71 CAFFE_DEFINE_PREALLOCATED_KNOWN_TYPE(
73 detail::_guard_long_unique<std::vector<long>>);
A type id is a unique id for a given C++ type.
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...