codecamp

TensorFlow绘制样本

tf.contrib.bayesflow.stochastic_tensor.SampleValue


tf.contrib.bayesflow.stochastic_tensor.SampleValue 类

定义在 tensorflow/contrib/bayesflow/python/ops/stochastic_tensor_impl.py.

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

绘制样本,可能会添加新的外部维度.
此值在其上下文中运行的 StochasticTensors 中抽取样本, 并根据所请求的形状增加秩.

例子:

mu = tf.zeros((2 ,3 ))
sigma = tf.ones((2 , 3 ))
with sg.value_type(sg.SampleValue()):
st = sg.StochasticTensor(
tf.contrib.distributions.Normal,mu = mu,sigma = sigma)
#1个抽取样品,并且不重塑
assertEqual( st.value().get_shape(),(2 ,3))
mu = tf .zeros((2 ,3 ))
sigma = tf.ones((2 , 3 ))
with sg.value_type(sg.SampleValue(4 )):
st = sg.StochasticTensor (
tf.contrib.distributions.Normal,mu = mu,sigma = sigma)
#4个绘制样品各自与形状(2,3)并连接
assertEqual(st.value().get_shape(),(4 ,2 ,3))

属性


  • shape
  • stop_gradient

方法


__init__

__init__ (
shape = (),
stop_gradient = False
)

根据形状取样.
对于给定的 StochasticTensor st 使用此值类型,st. value () 的形状将与 st.distribution.sample (形状)匹配.

ARGS:

  • shape:形状元组或 int32 张量.样品形状,默认是一个标量:取一个样本,不要改变大小.
  • stop_gradient:如果是真的,StochasticTensors 的价值被包装在 stop_gradient, 以避免反向传播.

declare_inputs

declare_inputs (
unused_stochastic_tensor ,
unused_inputs_dict
)

popped_above

popped_above ( unused_value_type )

pushed_above

push_above ( unused_value_type )
TensorFlow 具有观察值的 StochasticTensor
TensorFlow StochasticTensor详细介绍
温馨提示
下载编程狮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; }