MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / make_forward_graph

Method make_forward_graph

imperative/src/impl/op_def.cpp:82–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82EncodedSubgraph OpDef::make_forward_graph(
83 const OpDef& def, const SmallVector<LogicalTensorDesc>& inputs) {
84 using ForwardGraphCache =
85 OpMethResultCache<EncodedSubgraph, SmallVector<bool>, SmallVector<bool>>;
86 thread_local auto& cache = *ResourceManager::create_local<ForwardGraphCache>();
87 ForwardGraphCache::key_t cache_key{
88 const_cast<OpDef&>(def).shared_from_this(), inputs};
89 auto iter = cache.find(cache_key);
90 if (iter == cache.end()) {
91 iter = cache.insert({cache_key, def.trait()->make_forward_graph(def, inputs)})
92 .first;
93 }
94 return iter->second;
95}
96
97std::string OpDef::to_string() const {
98 std::string builder = trait()->name;

Callers 4

apply_on_var_nodeFunction · 0.80
apply_on_physical_tensorFunction · 0.80
utility.cppFile · 0.80

Calls 5

shared_from_thisMethod · 0.80
findMethod · 0.45
endMethod · 0.45
insertMethod · 0.45
traitMethod · 0.45

Tested by

no test coverage detected