"Fossies" - the Fresh Open Source Software Archive

Member "pytorch-1.8.2/tools/shared/module_loader.py" (23 Jul 2021, 224 Bytes) of package /linux/misc/pytorch-1.8.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "module_loader.py" see the Fossies "Dox" file reference documentation.

    1 def import_module(name, path):
    2     import importlib.util
    3     spec = importlib.util.spec_from_file_location(name, path)
    4     module = importlib.util.module_from_spec(spec)
    5     spec.loader.exec_module(module)
    6     return module