class_docstr: Randomly select a subsample of a range of indices.
  
  Internal use only. This should only be used by `plate`.
class_docstr_tok: ["Randomly","select","a","subsample","of","a","range","of","indices",".","Internal","use","only",".","This","should","only","be","used","by","`","plate","`","."]
docstr: :param int size: the size of the range to subsample from
  :param int subsample_size: the size of the returned subsample
  :param bool use_cuda: DEPRECATED, use the `device` arg instead.
      Whether to use cuda tensors.
  :param str device: device to place the `sample` and `log_prob`
      results on.
docstr_tok: [":","param","int","size",":","the","size","of","the","range","to","subsample","from",":","param","int","subsample_size",":","the","size","of","the","returned","subsample",":","param","bool","use_cuda",":","DEPRECATED",",","use","the","`","device","`","arg","instead",".","Whether","to","use","cuda","tensors",".",":","param","str","device",":","device","to","place","the","`","sample","`","and","`","log_prob","`","results","on","."]
code: def __init__(
      self,
      size: int,
      subsample_size: Optional[int],
      use_cuda: Optional[bool] = None,
      device: Optional[str] = None,
  ) -> None:
      """
      :param int size: the size of the range to subsample from
      :param int subsample_size: the size of the returned subsample
      :param bool use_cuda: DEPRECATED, use the `device` arg instead.
          Whether to use cuda tensors.
      :param str device: device to place the `sample` and `log_prob`
          results on.
      """
      self.size = size
      self.subsample_size = subsample_size
      self.use_cuda = use_cuda
      if self.use_cuda is not None:
          if self.use_cuda ^ (device != "cpu"):
              raise ValueError(
                  "Incompatible arg values use_cuda={}, device={}.".format(
                      use_cuda, device
                  )
              )
      with ignore_jit_warnings(
          ["torch.Tensor results are registered as constants"]
      ):
          self.device = device or torch.Tensor().device
  
file_path: pyro/pyro/poutine/subsample_messenger.py
imports: from typing import Optional, Tuple
  import torch
  from pyro.distributions.distribution import Distribution
  from pyro.poutine.indep_messenger import CondIndepStackFrame, IndepMessenger
  from pyro.poutine.runtime import Message, apply_stack
  from pyro.poutine.util import is_validation_enabled
  from pyro.util import ignore_jit_warnings
label_desc: Use image node_id 1 to create a new _Subsample object from inherited base classes: Distribution with example: obj = _Subsample(size, subsample_size, use_cuda, device)