| 80 | } |
| 81 | |
| 82 | EncodedSubgraph 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 | |
| 97 | std::string OpDef::to_string() const { |
| 98 | std::string builder = trait()->name; |
no test coverage detected