3 #include "c10/util/Registry.h" 4 #include "caffe2/core/blob.h" 5 #include <c10/util/typeid.h> 7 #include <unordered_map> 12 virtual size_t sizeBytes(
const Blob& blob)
const = 0;
18 std::unordered_map<TypeIdentifier, std::unique_ptr<BlobStatGetter>> map_;
19 void doRegister(
TypeIdentifier id, std::unique_ptr<BlobStatGetter>&& v);
22 template <
typename T,
typename Getter>
25 BlobStatRegistry::instance().doRegister(
26 TypeMeta::Id<T>(), std::unique_ptr<Getter>(
new Getter));
34 #define REGISTER_BLOB_STAT_GETTER(Type, BlobStatGetterClass) \ 35 static BlobStatRegistry::Registrar<Type, BlobStatGetterClass> \ 36 C10_ANONYMOUS_VARIABLE(BlobStatRegistry) 44 CAFFE2_API
size_t sizeBytes(
const Blob& blob);
Blob is a general container that hosts a typed pointer.
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 ...