set_multithreading_enabled#
- class torch.autograd.grad_mode.set_multithreading_enabled(mode)[source]#
Context-manager that sets multithreaded backwards on or off.
set_multithreading_enabled
will enable or disable multithreaded backwards based on its argumentmode
. It can be used as a context-manager or as a function.此上下文管理器是线程局部(thread local)的;它不会影响其他线程中的计算。
- 参数
mode (bool) – Flag whether to enable multithreaded backwards (
True
), or disable (False
).
注意
此 API 不适用于前向模式 AD。