code: def get_mask() -> Union[bool, torch.Tensor, None]:
      """
      Records the effects of enclosing ``poutine.mask`` handlers.
  
      This is useful for avoiding expensive ``pyro.factor()`` computations during
      prediction, when the log density need not be computed, e.g.::
  
          def model():
              # ...
              if poutine.get_mask() is not False:
                  log_density = my_expensive_computation()
                  pyro.factor("foo", log_density)
              # ...
  
      :returns: The mask.
      :rtype: None, bool, or torch.Tensor
      """
      return _inspect()["mask"]
  
imports: import functools
  from typing import TYPE_CHECKING, Callable, Dict, Generic, List, Optional, Set, Tuple, TypeVar, Union, overload
  import torch
  from typing_extensions import Literal, ParamSpec, TypedDict
  from pyro.params.param_store import _MODULE_NAMESPACE_DIVIDER, ParamStoreDict
label_desc: Use image node_id 8 for calling a global function with example usage: get_mask() and returns: _inspect