class_docstr: EXPERIMENTAL random variable container class around a distribution
  
  Representation of a distribution interpreted as a random variable. Rather
  than directly manipulating a probability density by applying pointwise
  transformations to it, this allows for simple arithmetic transformations of
  the random variable the distribution represents. For more flexibility,
  consider using the `transform` method. Note that if you perform a
  non-invertible transform (like `abs(X)` or `X**2`), certain things might
  not work properly.
  
  Can switch between `RandomVariable` and `Distribution` objects with the
  convenient `Distribution.rv` and `RandomVariable.dist` properties.
  
  Supports either chaining operations or arithmetic operator overloading.
  
  Example usage::
  
      # This should be equivalent to an Exponential distribution.
      RandomVariable(Uniform(0, 1)).log().neg().dist
  
      # These two distributions Y1, Y2 should be the same
      X = Uniform(0, 1).rv
      Y1 = X.mul(4).pow(0.5).sub(1).abs().neg().dist
      Y2 = (-abs((4*X)**(0.5) - 1)).dist
class_docstr_tok: ["EXPERIMENTAL","random","variable","container","class","around","a","distribution","Representation","of","a","distribution","interpreted","as","a","random","variable",".","Rather","than","directly","manipulating","a","probability","density","by","applying","pointwise","transformations","to","it",",","this","allows","for","simple","arithmetic","transformations","of","the","random","variable","the","distribution","represents",".","For","more","flexibility",",","consider","using","the","`","transform","`","method",".","Note","that","if","you","perform","a","non-invertible","transform","(","like","`","abs","(","X",")","`","or","`","X","*","*","2","`",")",",","certain","things","might","not","work","properly",".","Can","switch","between","`","RandomVariable","`","and","`","Distribution","`","objects","with","the","convenient","`","Distribution.rv","`","and","`","RandomVariable.dist","`","properties",".","Supports","either","chaining","operations","or","arithmetic","operator","overloading",".","Example","usage",":",":","#","This","should","be","equivalent","to","an","Exponential","distribution",".","RandomVariable","(","Uniform","(","0",",","1",")",")",".log","(",")",".neg","(",")",".dist","#","These","two","distributions","Y1",",","Y2","should","be","the","same","X","=","Uniform","(","0",",","1",")",".rv","Y1","=","X.mul","(","4",")",".pow","(","0.5",")",".sub","(","1",")",".abs","(",")",".neg","(",")",".dist","Y2","=","(","-abs","(","(","4","*","X",")","*","*","(","0.5",")","-","1",")",")",".dist"]
docstr: Wraps a distribution as a RandomVariable
  
  :param distribution: The `Distribution` object to wrap
  :type distribution: ~pyro.distributions.distribution.Distribution
docstr_tok: ["Wraps","a","distribution","as","a","RandomVariable",":","param","distribution",":","The","`","Distribution","`","object","to","wrap",":","type","distribution",":","~pyro.distributions.distribution.Distribution"]
code: def __init__(self, distribution):
      """Wraps a distribution as a RandomVariable
  
      :param distribution: The `Distribution` object to wrap
      :type distribution: ~pyro.distributions.distribution.Distribution
      """
      self.distribution = distribution
  
imports: from typing import Union
  from torch import Tensor
  from pyro.distributions import TransformedDistribution
  from pyro.distributions.transforms import AbsTransform, AffineTransform, ExpTransform, PowerTransform, SigmoidTransform, SoftmaxTransform, TanhTransform, Transform
label_desc: Use image node_id 1 to create a new RandomVariable object from inherited base classes: RVMagicOps, RVChainOps with example: obj = RandomVariable(distribution)