__init__.py 741 B

12345678910111213141516171819
  1. import os.path as _osp
  2. import sys
  3. from .throughput_benchmark import ThroughputBenchmark
  4. from ._crash_handler import enable_minidumps, disable_minidumps, enable_minidumps_on_exceptions
  5. from .cpp_backtrace import get_cpp_backtrace
  6. from .backend_registration import rename_privateuse1_backend
  7. # Set the module for a given object for nicer printing
  8. def set_module(obj, mod):
  9. if not isinstance(mod, str):
  10. raise TypeError("The mod argument should be a string")
  11. obj.__module__ = mod
  12. if sys.executable == "torch_deploy":
  13. # not valid inside torch_deploy interpreter, no paths exists for frozen modules
  14. cmake_prefix_path = None
  15. else:
  16. cmake_prefix_path = _osp.join(_osp.dirname(_osp.dirname(__file__)), 'share', 'cmake')