tf.contrib.bayesflow.stochastic_tensor.value_type()

tf.contrib.bayesflow.stochastic_tensor.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)):
  dt = sg.DistributionTensor(distributions.Normal, mu=mu, sigma=sigma)

In the example above, dt.value() (or equivalently, tf.identity(dt)) 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, SampleAndReshapeValue, 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.
doc_TensorFlow
2016-10-14 12:44:36
Comments
Leave a Comment

Please login to continue.