class_docstr: Context-manager that sets multithreaded backwards on or off.
  
  ``set_multithreading_enabled`` will enable or disable multithreaded backwards based on its argument :attr:`mode`.
  It can be used as a context-manager or as a function.
  
  This context manager is thread local; it will not affect computation
  in other threads.
  
  Args:
      mode (bool): Flag whether to enable multithreaded backwards (``True``), or disable
                   (``False``).
  
  .. note::
      This API does not apply to :ref:`forward-mode AD <forward-mode-ad>`.
class_docstr_tok: ["Context-manager","that","sets","multithreaded","backwards","on","or","off",".","``","set_multithreading_enabled","``","will","enable","or","disable","multithreaded","backwards","based","on","its","argument",":","attr",":","`","mode","`",".","It","can","be","used","as","a","context-manager","or","as","a","function",".","This","context","manager","is","thread","local",";","it","will","not","affect","computation","in","other","threads",".","Args",":","mode","(","bool",")",":","Flag","whether","to","enable","multithreaded","backwards","(","``","True","``",")",",","or","disable","(","``","False","``",")",".","..","note",":",":","This","API","does","not","apply","to",":","ref",":","`","forward-mode","AD","<","forward-mode-ad",">","`","."]
code: def __init__(self, mode: bool) -> None:
      self.prev = torch._C._is_multithreading_enabled()
      torch._C._set_multithreading_enabled(mode)
      self.mode = mode
  
imports: from typing import Any, Optional
  import torch
  from torch.utils._contextlib import _DecoratorContextManager, _NoParamDecoratorContextManager, F
label_desc: Use image node_id 1 to create a new set_multithreading_enabled object from inherited base classes: _DecoratorContextManager with example: obj = set_multithreading_enabled(mode)