LookUpOrCreateCachedGraph Class — pytorch Architecture
Architecture documentation for the LookUpOrCreateCachedGraph class in OperationUtils.h from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/native/mps/OperationUtils.h lines 415–431
template <typename T>
inline T* LookUpOrCreateCachedGraph(const std::string& key, std::function<void(MPSGraph*, T*)> instantiate) {
auto cache_ = MPSGraphCache::getInstance();
if (auto rc = cache_->LookUpAs<T>(key)) {
return rc;
}
return cache_->CreateCachedGraphAs<T>(key, ^mps::MPSCachedGraph*() {
T* newCachedGraph = nil;
@autoreleasepool {
// Initialize graph
auto mpsGraph = mps::make_mps_graph();
newCachedGraph = new T(mpsGraph);
instantiate(mpsGraph, newCachedGraph);
}
return newCachedGraph;
});
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free