mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 13:44:15 +08:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/41687 Specifically, this makes a new library (lazy), which can be used from both core and workspace. This allows workspace.Createnet to trigger lazy loading of dyndep dependencies. Test Plan: Added a unit test specifically for workspace.CreateNet Reviewed By: dzhulgakov Differential Revision: D22441877 fbshipit-source-id: 3a9d1af9962585d08ea2566c9c85bec7377d39f2
15 lines
277 B
Python
15 lines
277 B
Python
## @package workspace
|
|
# Module caffe2.python.lazy
|
|
|
|
_import_lazy_calls = []
|
|
|
|
def RegisterLazyImport(lazy):
|
|
global _import_lazy_calls
|
|
_import_lazy_calls += [lazy]
|
|
|
|
|
|
def TriggerLazyImport():
|
|
global _import_lazy_calls
|
|
for lazy in _import_lazy_calls:
|
|
lazy()
|