parameters: (self, dist, value, name=None)
docstring: Construct an `ObservedStochasticTensor`.
  
      `ObservedStochasticTensor` is backed by distribution `dist` and uses the
      provided value instead of using the current value type to draw a value from
      the distribution. The provided value argument must be appropriately shaped
      to have come from the distribution.
  
      Args:
        dist: an instance of `Distribution`.
        value: a Tensor containing the observed value
        name: a name for this `ObservedStochasticTensor` and its ops.
  
      Raises:
        TypeError: if `dist` is not an instance of `Distribution`.
        ValueError: if `value` is not compatible with the distribution.
docstring_summary: Construct an `ObservedStochasticTensor`.
docstring_tokens: Construct an ObservedStochasticTensor .
function: def __init__(self, dist, value, name=None):
      """Construct an `ObservedStochasticTensor`.
  
      `ObservedStochasticTensor` is backed by distribution `dist` and uses the
      provided value instead of using the current value type to draw a value from
      the distribution. The provided value argument must be appropriately shaped
      to have come from the distribution.
  
      Args:
        dist: an instance of `Distribution`.
        value: a Tensor containing the observed value
        name: a name for this `ObservedStochasticTensor` and its ops.
  
      Raises:
        TypeError: if `dist` is not an instance of `Distribution`.
        ValueError: if `value` is not compatible with the distribution.
      """
      if not isinstance(dist, distribution.Distribution):
        raise TypeError("dist must be an instance of Distribution")
      with ops.name_scope(name, "ObservedStochasticTensor", [value]) as scope:
        self._name = scope
        self._dist = dist
        dist_shape = self._dist.batch_shape.concatenate(
            self._dist.event_shape)
        value = ops.convert_to_tensor(value)
        value_shape = value.get_shape()
  
        if not value_shape.is_compatible_with(dist_shape):
          if value_shape.ndims < dist_shape.ndims:
            raise ValueError(
                "Rank of observed value (%d) must be >= rank of a sample from the"
                " distribution (%d)." % (value_shape.ndims, dist_shape.ndims))
          sample_shape = value_shape[(value_shape.ndims - dist_shape.ndims):]
          if not sample_shape.is_compatible_with(dist_shape):
            raise ValueError(
                "Shape of observed value %s is incompatible with the shape of a "
                "sample from the distribution %s." % (value_shape, dist_shape))
        if value.dtype != self._dist.dtype:
          raise ValueError("Type of observed value (%s) does not match type of "
                           "distribution (%s)." % (value.dtype, self._dist.dtype))
        self._value = array_ops.identity(value)
      # pylint: disable=non-parent-init-called
      BaseStochasticTensor.__init__(self)
function_tokens: def __init__ ( self , dist , value , name = None ) : if not isinstance ( dist , distribution . Distribution ) : raise TypeError ( "dist must be an instance of Distribution" ) with ops . name_scope ( name , "ObservedStochasticTensor" , [ value ] ) as scope : self . _name = scope self . _dist = dist dist_shape = self . _dist . batch_shape . concatenate ( self . _dist . event_shape ) value = ops . convert_to_tensor ( value ) value_shape = value . get_shape ( ) if not value_shape . is_compatible_with ( dist_shape ) : if value_shape . ndims < dist_shape . ndims : raise ValueError ( "Rank of observed value (%d) must be >= rank of a sample from the" " distribution (%d)." % ( value_shape . ndims , dist_shape . ndims ) ) sample_shape = value_shape [ ( value_shape . ndims - dist_shape . ndims ) : ] if not sample_shape . is_compatible_with ( dist_shape ) : raise ValueError ( "Shape of observed value %s is incompatible with the shape of a " "sample from the distribution %s." % ( value_shape , dist_shape ) ) if value . dtype != self . _dist . dtype : raise ValueError ( "Type of observed value (%s) does not match type of " "distribution (%s)." % ( value . dtype , self . _dist . dtype ) ) self . _value = array_ops . identity ( value ) # pylint: disable=non-parent-init-called BaseStochasticTensor . __init__ ( self )