3 #include "caffe2/core/blob.h" 4 #include "caffe2/core/registry.h" 5 #include "caffe2/core/typeid.h" 7 #include <unordered_map> 12 virtual size_t sizeBytes(
const Blob& blob)
const = 0;
18 std::unordered_map<CaffeTypeId, std::unique_ptr<BlobStatGetter>> map_;
19 void doRegister(CaffeTypeId
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 CAFFE_ANONYMOUS_VARIABLE(BlobStatRegistry) 44 size_t sizeBytes(
const Blob& blob);
Simple registry implementation in Caffe2 that uses static variables to register object creators durin...
Blob is a general container that hosts a typed pointer.