mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
Part of #109802 Pull Request resolved: https://github.com/pytorch/pytorch/pull/111377 Approved by: https://github.com/albanD, https://github.com/aaronenyeshi
22 lines
584 B
Python
22 lines
584 B
Python
import sys
|
|
import types
|
|
|
|
import torch
|
|
|
|
|
|
class _Deterministic(types.ModuleType):
|
|
@property
|
|
def fill_uninitialized_memory(self):
|
|
"""
|
|
Whether to fill uninitialized memory with a known value when
|
|
:meth:`torch.use_deterministic_algorithms()` is set to ``True``.
|
|
"""
|
|
return torch._C._get_deterministic_fill_uninitialized_memory()
|
|
|
|
@fill_uninitialized_memory.setter
|
|
def fill_uninitialized_memory(self, mode):
|
|
return torch._C._set_deterministic_fill_uninitialized_memory(mode)
|
|
|
|
|
|
sys.modules[__name__].__class__ = _Deterministic
|