parameters: (dist_value_type)
docstring: Creates a value type context for any StochasticTensor created within.
  
    Typical usage:
  
    ```
    with sg.value_type(sg.MeanValue(stop_gradients=True)):
      st = sg.StochasticTensor(tf.contrib.distributions.Normal, mu=mu,
                               sigma=sigma)
    ```
  
    In the example above, `st.value()` (or equivalently, `tf.identity(st)`) will
    be the mean value of the Normal distribution, i.e., `mu` (possibly
    broadcasted to the shape of `sigma`).  Furthermore, because the `MeanValue`
    was marked with `stop_gradients=True`, this value will have been wrapped
    in a `stop_gradients` call to disable any possible backpropagation.
  
    Args:
      dist_value_type: An instance of `MeanValue`, `SampleValue`, or
        any other stochastic value type.
  
    Yields:
      A context for `StochasticTensor` objects that controls the
      value created when they are initialized.
  
    Raises:
      TypeError: if `dist_value_type` is not an instance of a stochastic value
        type.
docstring_summary: Creates a value type context for any StochasticTensor created within.
docstring_tokens: Creates a value type context for any StochasticTensor created within .
function: def value_type(dist_value_type):
    """Creates a value type context for any StochasticTensor created within.
  
    Typical usage:
  
    ```
    with sg.value_type(sg.MeanValue(stop_gradients=True)):
      st = sg.StochasticTensor(tf.contrib.distributions.Normal, mu=mu,
                               sigma=sigma)
    ```
  
    In the example above, `st.value()` (or equivalently, `tf.identity(st)`) will
    be the mean value of the Normal distribution, i.e., `mu` (possibly
    broadcasted to the shape of `sigma`).  Furthermore, because the `MeanValue`
    was marked with `stop_gradients=True`, this value will have been wrapped
    in a `stop_gradients` call to disable any possible backpropagation.
  
    Args:
      dist_value_type: An instance of `MeanValue`, `SampleValue`, or
        any other stochastic value type.
  
    Yields:
      A context for `StochasticTensor` objects that controls the
      value created when they are initialized.
  
    Raises:
      TypeError: if `dist_value_type` is not an instance of a stochastic value
        type.
    """
    if not isinstance(dist_value_type, _StochasticValueType):
      raise TypeError("dist_value_type must be a Distribution Value Type")
    thread_id = threading.current_thread().ident
    stack = _STOCHASTIC_VALUE_STACK[thread_id]
    if stack:
      stack[-1].pushed_above(dist_value_type)
    stack.append(dist_value_type)
    yield
    stack.pop()
    if stack:
      stack[-1].popped_above(dist_value_type)
function_tokens: def value_type ( dist_value_type ) : if not isinstance ( dist_value_type , _StochasticValueType ) : raise TypeError ( "dist_value_type must be a Distribution Value Type" ) thread_id = threading . current_thread ( ) . ident stack = _STOCHASTIC_VALUE_STACK [ thread_id ] if stack : stack [ - 1 ] . pushed_above ( dist_value_type ) stack . append ( dist_value_type ) yield stack . pop ( ) if stack : stack [ - 1 ] . popped_above ( dist_value_type )