blob: 95b7fa05bfe2c0832698f136f546e2c1b16ccc98 [file] [log] [blame]
import torch._C
from contextlib import contextmanager
__all__ = ['enable_python_dispatcher', 'no_python_dispatcher']
@contextmanager
def no_python_dispatcher():
g = torch._C._DisablePythonDispatcher()
try:
yield
finally:
del g
@contextmanager
def enable_python_dispatcher():
g = torch._C._EnablePythonDispatcher()
try:
yield
finally:
del g