mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
Override the resolve_library_path in FBCode (#17497)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/17497 The following problems have been addressed: 1) import torch.ops correctly, 2) make realpath call optional Reviewed By: dzhulgakov Differential Revision: D14094358 fbshipit-source-id: 2f9a6fca656867287a7c82c465a4554384ff7323
This commit is contained in:
committed by
Facebook Github Bot
parent
b21e9e4dae
commit
8bc3b66be9
@ -4,9 +4,9 @@ import contextlib
|
||||
import ctypes
|
||||
import sys
|
||||
import types
|
||||
import os.path
|
||||
|
||||
import torch.jit
|
||||
import torch._utils_internal
|
||||
|
||||
# Query `hasattr` only once.
|
||||
_SET_GLOBAL_FLAGS = hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags')
|
||||
@ -94,7 +94,7 @@ class _Ops(types.ModuleType):
|
||||
Arguments:
|
||||
path (str): A path to a shared library to load.
|
||||
"""
|
||||
path = os.path.realpath(path)
|
||||
path = torch._utils_internal.resolve_library_path(path)
|
||||
with dl_open_guard():
|
||||
# Import the shared library into the process, thus running its
|
||||
# static (global) initialization code in order to register custom
|
||||
|
@ -29,5 +29,9 @@ def prepare_multiprocessing_environment(path):
|
||||
pass
|
||||
|
||||
|
||||
def resolve_library_path(path):
|
||||
return os.path.realpath(path)
|
||||
|
||||
|
||||
TEST_MASTER_ADDR = '127.0.0.1'
|
||||
TEST_MASTER_PORT = 29500
|
||||
|
Reference in New Issue
Block a user