codecamp

TensorFlow创建值类型上下文

tf.contrib.bayesflow.stochastic_tensor.value_type


tf.contrib.bayesflow.stochastic_tensor.value_type

value_type (
* args ,
** kwds
)

参见指南:BayesFlow随机张量(contrib)>随机张量值类型

为内部创建的任何 StochasticTensor 创建值类型上下文.

典型用法:

with sg.value_type(sg.MeanValue( stop_gradients = True)):
st = sg.StochasticTensor ( tf.contrib.distributions.Normal,mu = mu,
sigma = sigma)

在上面的例子中, st. value () (或等效地,tf. identity(st)) 是正态分布,即平均值,(可能是对 sigma 的形状进行广播).此外,由于 MeanValue 标记为 stop_gradients = True, 因此该值将被包装在 stop_gradients 调用中以禁用任何可能的反向传播.

ARGS:

  • dist_value_type:MeanValue、SampleValue 或任何其他随机值类型的实例.

Yelds:

用于控制在初始化时创建的值的 StochasticTensor 对象的上下文.

注意:

  • TypeError:如果 dist_value_type 不是随机值类型的实例.
TensorFlow StochasticTensor详细介绍
TensorFlow 变分推理操作
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

TensorFlow 函数介绍

TensorFlow 函数模块:tf

TensorFlow的image模块

TensorFlow使用之tf.io

TensorFlow使用之tf.keras

TensorFlow函数教程:tf.keras.applications

TensorFlow函数教程:tf.keras.backend

TensorFlow使用之tf.metrics

TensorFlow使用之tf.nn

TensorFlow使用之tf.python_io

TensorFlow 功能函数

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }