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 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.

© 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

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部