class_docstr: Base class for parameterized probability distributions.
  
  Distributions in Pyro are stochastic function objects with :meth:`sample` and
  :meth:`log_prob` methods. Distribution are stochastic functions with fixed
  parameters::
  
    d = dist.Bernoulli(param)
    x = d()                                # Draws a random sample.
    p = d.log_prob(x)                      # Evaluates log probability of x.
  
  **Implementing New Distributions**:
  
  Derived classes must implement the methods: :meth:`sample`,
  :meth:`log_prob`.
  
  **Examples**:
  
  Take a look at the `examples <http://pyro.ai/examples>`_ to see how they interact
  with inference algorithms.
class_docstr_tok: ["Base","class","for","parameterized","probability","distributions",".","Distributions","in","Pyro","are","stochastic","function","objects","with",":","meth",":","`","sample","`","and",":","meth",":","`","log_prob","`","methods",".","Distribution","are","stochastic","functions","with","fixed","parameters",":",":","d","=","dist.Bernoulli","(","param",")","x","=","d","(",")","#","Draws","a","random","sample",".","p","=","d.log_prob","(","x",")","#","Evaluates","log","probability","of","x",".","*","*","Implementing","New","Distributions","*","*",":","Derived","classes","must","implement","the","methods",":",":","meth",":","`","sample","`",",",":","meth",":","`","log_prob","`",".","*","*","Examples","*","*",":","Take","a","look","at","the","`","examples","<","http",":","\/\/pyro.ai\/examples",">","`","_","to","see","how","they","interact","with","inference","algorithms","."]
docstr: Force reparameterized or detached sampling on a single distribution
  instance. This sets the ``.has_rsample`` attribute in-place.
  
  This is useful to instruct inference algorithms to avoid
  reparameterized gradients for variables that discontinuously determine
  downstream control flow.
  
  :param bool value: Whether samples will be pathwise differentiable.
  :return: self
  :rtype: Distribution
docstr_tok: ["Force","reparameterized","or","detached","sampling","on","a","single","distribution","instance",".","This","sets","the","``",".has_rsample","``","attribute","in-place",".","This","is","useful","to","instruct","inference","algorithms","to","avoid","reparameterized","gradients","for","variables","that","discontinuously","determine","downstream","control","flow",".",":","param","bool","value",":","Whether","samples","will","be","pathwise","differentiable",".",":","return",":","self",":","rtype",":","Distribution"]
code: def has_rsample_(self, value):
      """
      Force reparameterized or detached sampling on a single distribution
      instance. This sets the ``.has_rsample`` attribute in-place.
  
      This is useful to instruct inference algorithms to avoid
      reparameterized gradients for variables that discontinuously determine
      downstream control flow.
  
      :param bool value: Whether samples will be pathwise differentiable.
      :return: self
      :rtype: Distribution
      """
      if not (value is True or value is False):
          raise ValueError(
              "Expected value in [False,True], actual {}".format(value)
          )
      self.has_rsample = value
      return self
  
file_path: pyro/pyro/distributions/distribution.py
imports: import functools
  import inspect
  from abc import ABCMeta, abstractmethod
  import torch
  from pyro.distributions.score_parts import ScoreParts
label_desc: Use image node_id 7 for calling the Distribution obj's underlying member method code with example usage: obj.has_rsample_(value) and returns: self