Copy
tensorplay.use_deterministic_algorithms
- tensorplay.use_deterministic_algorithms(mode: bool, *, warn_only: bool = False) None[source]
Sets whether TensorPlay operations must use “deterministic” algorithms. That is, algorithms which, given the same input, and when run on the same software and hardware, always produce the same output. When enabled, operations will use deterministic algorithms when available, and if only nondeterministic algorithms are available they will throw a
RuntimeErrorwhen called.Note
This setting alone is not always enough to make an application reproducible. Refer to Reproducibility for more information.
Note
tensorplay.set_deterministic_debug_mode()offers an alternative interface for this feature.Note that deterministic operations tend to have worse performance than nondeterministic operations.
Note
This flag does not detect or prevent nondeterministic behavior caused by calling an inplace operation on a tensor with an internal memory overlap or by giving such a tensor as the
outargument for an operation. In these cases, multiple writes of different data may target a single memory location, and the order of writes is not guaranteed.- Parameters:
mode (
bool) – If True, makes potentially nondeterministic operations switch to a deterministic algorithm or throw a runtime error. If False, allows nondeterministic operations.- Keyword Arguments:
warn_only (
bool, optional) – If True, operations that do not have a deterministic implementation will throw a warning instead of an error. Default:False
Example:
>>> # xdoctest: +SKIP >>> tensorplay.use_deterministic_algorithms(True)
Help improve this page
Found an error, an unclear step, or a missing example?
