# dependency (with_framework_lib=true), since we do not need RTLD_GLOBAL. from tensorflow.python import pywrap_dlopen_global_flags _use_dlopen_global_flags = True except ImportError: _use_dlopen_global_flags = False # On UNIX-based platforms, pywrap_tensorflow is a SWIG-generated # python library that dynamically loads _pywrap_tensorflow.so. _can_set_rtld_local = (hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags')) if _can_set_rtld_local: _default_dlopen_flags = sys.getdlopenflags() try: if _use_dlopen_global_flags: pywrap_dlopen_global_flags.set_dlopen_flags() elif _can_set_rtld_local: # Ensure RTLD_LOCAL behavior for platforms where it isn't the default # (macOS). On Linux RTLD_LOCAL is 0, so this does nothing (and would not # override an RTLD_GLOBAL in _default_dlopen_flags). sys.setdlopenflags(_default_dlopen_flags | ctypes.RTLD_LOCAL) from tensorflow.python.pywrap_tensorflow_internal import * from tensorflow.python.pywrap_tensorflow_internal import __version__ from tensorflow.python.pywrap_tensorflow_internal import __git_version__ from tensorflow.python.pywrap_tensorflow_internal import __compiler_version__ if _use_dlopen_global_flags: pywrap_dlopen_global_flags.reset_dlopen_flags() elif _can_set_rtld_local: sys.setdlopenflags(_default_dlopen_flags)
# dependency (with_framework_lib=true), since we do not need RTLD_GLOBAL. from tensorflow.python import pywrap_dlopen_global_flags _use_dlopen_global_flags = True except ImportError: _use_dlopen_global_flags = False # On UNIX-based platforms, pywrap_tensorflow is a SWIG-generated # python library that dynamically loads _pywrap_tensorflow.so. _can_set_rtld_local = (hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags')) if _can_set_rtld_local: _default_dlopen_flags = sys.getdlopenflags() try: if _use_dlopen_global_flags: pywrap_dlopen_global_flags.set_dlopen_flags() elif _can_set_rtld_local: # Ensure RTLD_LOCAL behavior for platforms where it isn't the default # (macOS). On Linux RTLD_LOCAL is 0, so this does nothing (and would not # override an RTLD_GLOBAL in _default_dlopen_flags). sys.setdlopenflags(_default_dlopen_flags | ctypes.RTLD_LOCAL) from tensorflow.python.pywrap_tensorflow_internal import * from tensorflow.python.pywrap_tensorflow_internal import __version__ from tensorflow.python.pywrap_tensorflow_internal import __git_version__ from tensorflow.python.pywrap_tensorflow_internal import __compiler_version__ from tensorflow.python.pywrap_tensorflow_internal import __cxx11_abi_flag__ if _use_dlopen_global_flags: pywrap_dlopen_global_flags.reset_dlopen_flags() elif _can_set_rtld_local: