contrib.bayesflow.stochastic_tensor.value_type
tf.contrib.bayesflow.stochastic_tensor.value_type
tf.contrib.bayesflow.stochastic_tensor.value_type
value_type( *args, **kwds )
See the guide: BayesFlow Stochastic Tensors (contrib) > Stochastic Tensor Value Types
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 ofMeanValue
,SampleValue
, or any other stochastic value type.
Yields:
A context for StochasticTensor
objects that controls the value created when they are initialized.
Raises:
-
TypeError
: ifdist_value_type
is not an instance of a stochastic value type.
© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/contrib/bayesflow/stochastic_tensor/value_type