Configurable flushing denormal numbers on CPU (#5294)

* Configurable flushing denormal numbers on CPU

* Formatting

* Update docs

* Minor doc changes
This commit is contained in:
Choongwoo Han
2018-02-20 09:23:43 +09:00
committed by Soumith Chintala
parent 6279367297
commit fae6c67121
7 changed files with 87 additions and 0 deletions

View File

@ -3932,6 +3932,37 @@ Example::
""")
add_docstr(torch._C.set_flush_denormal,
r"""
set_flush_denormal(mode) -> bool
Disables denormal floating numbers on CPU.
Returns ``True`` if your system supports flushing denormal numbers and it
successfully configures flush denormal mode. :meth:`~torch.set_flush_denormal`
is only supported on x86 architectures supporting SSE3.
Args:
mode (bool): Controls whether to enable flush denormal mode or not
Example::
>>> torch.set_flush_denormal(True)
True
>>> torch.DoubleTensor([1e-323])
0
[torch.DoubleTensor of size 1]
>>> torch.set_flush_denormal(False)
True
>>> torch.DoubleTensor([1e-323])
9.88131e-324 *
1.0000
[torch.DoubleTensor of size 1]
""")
add_docstr(torch._C.set_num_threads,
r"""
set_num_threads(int)