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

Function _import_module

python/oneflow/hub.py:109–118  ·  view source on GitHub ↗
(name, path)

Source from the content-addressed store, hash-verified

107
108# Copied from tools/shared/module_loader to be included in oneflow package
109def _import_module(name, path):
110 import importlib.util
111 from importlib.abc import Loader
112
113 spec = importlib.util.spec_from_file_location(name, path)
114 assert spec is not None
115 module = importlib.util.module_from_spec(spec)
116 assert isinstance(spec.loader, Loader)
117 spec.loader.exec_module(module)
118 return module
119
120
121def _remove_if_exists(path):

Callers 3

listFunction · 0.85
helpFunction · 0.85
_load_localFunction · 0.85

Calls 1

exec_moduleMethod · 0.80

Tested by

no test coverage detected