1 #include "caffe2/core/blob_stats.h" 5 const BlobStatGetter* BlobStatRegistry::get(TypeIdentifier
id) {
6 auto it = map_.find(
id);
7 if (it == map_.end()) {
10 return it->second.get();
13 BlobStatRegistry& BlobStatRegistry::instance() {
14 static BlobStatRegistry registry;
18 void BlobStatRegistry::doRegister(
20 std::unique_ptr<BlobStatGetter>&& v) {
22 if (map_.count(
id) > 0) {
23 throw std::runtime_error(
"BlobStatRegistry: Type already registered.");
25 map_[id] = std::move(v);
30 size_t sizeBytes(
const Blob& blob) {
31 auto* p = BlobStatRegistry::instance().get(blob.meta().id());
32 return p ? p->sizeBytes(blob) : 0;
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...