MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / get_graph

Method get_graph

python/oneflow/nn/graph/cache.py:230–247  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

228 return tuple(flattened_shapes)
229
230 def get_graph(self, *args, **kwargs):
231 if self._cache is None:
232 self._cache = LRUCache(self._cache_size)
233
234 cache_key = hash(self.gen_key(*args, **kwargs))
235 graph = self._cache.get(cache_key)
236
237 # Create graph
238 if graph is None:
239 self._base_graph._print(
240 0,
241 0,
242 self._base_graph._shallow_repr()
243 + " got a new input shape, is compiling a new graph.",
244 )
245 graph = self._init_and_get_a_graph_in_cache(cache_key)
246
247 return graph

Callers 2

__call__Method · 0.95
_compileMethod · 0.95

Calls 7

gen_keyMethod · 0.95
LRUCacheClass · 0.85
hashFunction · 0.85
_printMethod · 0.80
getMethod · 0.45
_shallow_reprMethod · 0.45

Tested by

no test coverage detected