我想在TensorFlow中使用批量规范化.我找到了相关的C++源代码core/ops/nn_ops.cc.但是,我没有在tensorflow.org上找到它.
BN在MLP和CNN中有不同的语义,所以我不确定这个BN究竟是做什么的.
我没有找到一个叫做的方法MovingMoments.
如果你有两个不相交的图,并想要链接它们,转过来:
x = tf.placeholder('float')
y = f(x)
y = tf.placeholder('float')
z = f(y)
Run Code Online (Sandbox Code Playgroud)
进入这个:
x = tf.placeholder('float')
y = f(x)
z = g(y)
Run Code Online (Sandbox Code Playgroud)
有没有办法做到这一点?在某些情况下,它似乎可以使构造更容易.
例如,如果您有一个将输入图像作为a的图形tf.placeholder,并且想要优化输入图像,那么深层梦想的样式是否有办法用占位符替换tf.variable节点?或者在构建图表之前你必须考虑到这一点吗?
我正在尝试运行张量流图来训练模型,并使用单独的评估数据集定期评估.训练和评估数据都是使用队列运行器实现的.
我目前的解决方案是在同一图表中创建两个输入并使用tf.cond依赖于is_training占位符.我的问题由以下代码突出显示:
import tensorflow as tf
from tensorflow.models.image.cifar10 import cifar10
from time import time
def get_train_inputs(is_training):
return cifar10.inputs(False)
def get_eval_inputs(is_training):
return cifar10.inputs(True)
def get_mixed_inputs(is_training):
train_inputs = get_train_inputs(None)
eval_inputs = get_eval_inputs(None)
return tf.cond(is_training, lambda: train_inputs, lambda: eval_inputs)
def time_inputs(inputs_fn, n_runs=10):
graph = tf.Graph()
with graph.as_default():
is_training = tf.placeholder(dtype=tf.bool, shape=(),
name='is_training')
images, labels = inputs_fn(is_training)
with tf.Session(graph=graph) as sess:
coordinator = tf.train.Coordinator()
threads = tf.train.start_queue_runners(sess=sess, coord=coordinator)
t = time()
for i in range(n_runs):
im, l = sess.run([images, labels], …Run Code Online (Sandbox Code Playgroud)