Add LookupModel() to find a model in the model cache without creating it.
Showing the changes to tools/perf/scripts/python (1 of 1 file). Show all
Unified · Split
| @@ -341,6 +341,15 @@ def LookupCreateModel(model_name, create_fn): · 340 unmodified lines | ||
| 341 | 341 | model_cache_lock.release() |
| 342 | 342 | return model |
| 343 | 343 | |
| 344 | +def LookupModel(model_name): | |
| 345 | + model_cache_lock.acquire() | |
| 346 | + try: | |
| 347 | + model = model_cache[model_name] | |
| 348 | + except: | |
| 349 | + model = None | |
| 350 | + model_cache_lock.release() | |
| 351 | + return model | |
| 352 | + | |
| 344 | 353 | # Find bar |
| 345 | 354 | |
| 346 | 355 | class FindBar(): |