- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是 tensorflow 的新手。我有一些我想理解的代码。有没有办法在 sess.run 中获取“feed_dict”的所有可能输入的列表? feed_dict 的结构是始终相同还是取决于 session ?
代码:
sess.run([input,input2],feed_dict={is_train:False,y:stuff,user:[_user]})
# populate session graph to look at place holders
# place holders are possible inputs to sess.run()
for op in sess.graph.get_operations():
print(op.name, op.type)
(u'Placeholder', u'Placeholder')
(u'ToFloat', u'Cast')
(u'sub/y', u'Const')
(u'sub', u'Sub')
(u'div/y', u'Const')
(u'div', u'RealDiv')
(u'Placeholder_1', u'Placeholder')
(u'DVBPR/Reshape/shape', u'Const')
(u'DVBPR/Reshape', u'Reshape')
(u'DVBPR/wc1/Initializer/random_uniform/shape', u'Const')
(u'DVBPR/wc1/Initializer/random_uniform/min', u'Const')
(u'DVBPR/wc1/Initializer/random_uniform/max', u'Const')
(u'DVBPR/wc1/Initializer/random_uniform/RandomUniform', u'RandomUniform')
(u'DVBPR/wc1/Initializer/random_uniform/sub', u'Sub')
(u'DVBPR/wc1/Initializer/random_uniform/mul', u'Mul')
(u'DVBPR/wc1/Initializer/random_uniform', u'Add')
(u'DVBPR/wc1', u'VariableV2')
(u'DVBPR/wc1/Assign', u'Assign')
(u'DVBPR/wc1/read', u'Identity')
(u'DVBPR/zeros', u'Const')
(u'DVBPR/bc1', u'VariableV2')
(u'DVBPR/bc1/Assign', u'Assign')
(u'DVBPR/bc1/read', u'Identity')
(u'DVBPR/Conv2D', u'Conv2D')
(u'DVBPR/BiasAdd', u'BiasAdd')
(u'DVBPR/Relu', u'Relu')
(u'DVBPR/Relu_1', u'Relu')
(u'DVBPR/MaxPool', u'MaxPool')
(u'DVBPR/wc2/Initializer/random_uniform/shape', u'Const')
(u'DVBPR/wc2/Initializer/random_uniform/min', u'Const')
(u'DVBPR/wc2/Initializer/random_uniform/max', u'Const')
(u'DVBPR/wc2/Initializer/random_uniform/RandomUniform', u'RandomUniform')
(u'DVBPR/wc2/Initializer/random_uniform/sub', u'Sub')
(u'DVBPR/wc2/Initializer/random_uniform/mul', u'Mul')
(u'DVBPR/wc2/Initializer/random_uniform', u'Add')
(u'DVBPR/wc2', u'VariableV2')
(u'DVBPR/wc2/Assign', u'Assign')
(u'DVBPR/wc2/read', u'Identity')
(u'DVBPR/zeros_1', u'Const')
(u'DVBPR/bc2', u'VariableV2')
(u'DVBPR/bc2/Assign', u'Assign')
(u'DVBPR/bc2/read', u'Identity')
(u'DVBPR/Conv2D_1', u'Conv2D')
(u'DVBPR/BiasAdd_1', u'BiasAdd')
(u'DVBPR/Relu_2', u'Relu')
(u'DVBPR/Relu_3', u'Relu')
(u'DVBPR/MaxPool_1', u'MaxPool')
(u'DVBPR/wc3/Initializer/random_uniform/shape', u'Const')
(u'DVBPR/wc3/Initializer/random_uniform/min', u'Const')
(u'DVBPR/wc3/Initializer/random_uniform/max', u'Const')
(u'DVBPR/wc3/Initializer/random_uniform/RandomUniform', u'RandomUniform')
(u'DVBPR/wc3/Initializer/random_uniform/sub', u'Sub')
(u'DVBPR/wc3/Initializer/random_uniform/mul', u'Mul')
(u'DVBPR/wc3/Initializer/random_uniform', u'Add')
(u'DVBPR/wc3', u'VariableV2')
(u'DVBPR/wc3/Assign', u'Assign')
(u'DVBPR/wc3/read', u'Identity')
(u'DVBPR/zeros_2', u'Const')
(u'DVBPR/bc3', u'VariableV2')
(u'DVBPR/bc3/Assign', u'Assign')
(u'DVBPR/bc3/read', u'Identity')
(u'DVBPR/Conv2D_2', u'Conv2D')
(u'DVBPR/BiasAdd_2', u'BiasAdd')
(u'DVBPR/Relu_4', u'Relu')
(u'DVBPR/Relu_5', u'Relu')
(u'DVBPR/wc4/Initializer/random_uniform/shape', u'Const')
(u'DVBPR/wc4/Initializer/random_uniform/min', u'Const')
(u'DVBPR/wc4/Initializer/random_uniform/max', u'Const')
(u'DVBPR/wc4/Initializer/random_uniform/RandomUniform', u'RandomUniform')
(u'DVBPR/wc4/Initializer/random_uniform/sub', u'Sub')
(u'DVBPR/wc4/Initializer/random_uniform/mul', u'Mul')
(u'DVBPR/wc4/Initializer/random_uniform', u'Add')
(u'DVBPR/wc4', u'VariableV2')
(u'DVBPR/wc4/Assign', u'Assign')
(u'DVBPR/wc4/read', u'Identity')
(u'DVBPR/zeros_3', u'Const')
(u'DVBPR/bc4', u'VariableV2')
(u'DVBPR/bc4/Assign', u'Assign')
(u'DVBPR/bc4/read', u'Identity')
(u'DVBPR/Conv2D_3', u'Conv2D')
(u'DVBPR/BiasAdd_3', u'BiasAdd')
(u'DVBPR/Relu_6', u'Relu')
(u'DVBPR/Relu_7', u'Relu')
(u'DVBPR/wc5/Initializer/random_uniform/shape', u'Const')
(u'DVBPR/wc5/Initializer/random_uniform/min', u'Const')
(u'DVBPR/wc5/Initializer/random_uniform/max', u'Const')
(u'DVBPR/wc5/Initializer/random_uniform/RandomUniform', u'RandomUniform')
(u'DVBPR/wc5/Initializer/random_uniform/sub', u'Sub')
(u'DVBPR/wc5/Initializer/random_uniform/mul', u'Mul')
(u'DVBPR/wc5/Initializer/random_uniform', u'Add')
(u'DVBPR/wc5', u'VariableV2')
(u'DVBPR/wc5/Assign', u'Assign')
(u'DVBPR/wc5/read', u'Identity')
(u'DVBPR/zeros_4', u'Const')
(u'DVBPR/bc5', u'VariableV2')
(u'DVBPR/bc5/Assign', u'Assign')
(u'DVBPR/bc5/read', u'Identity')
(u'DVBPR/Conv2D_4', u'Conv2D')
(u'DVBPR/BiasAdd_4', u'BiasAdd')
(u'DVBPR/Relu_8', u'Relu')
(u'DVBPR/Relu_9', u'Relu')
(u'DVBPR/MaxPool_2', u'MaxPool')
(u'DVBPR/Reshape_1/shape', u'Const')
(u'DVBPR/Reshape_1', u'Reshape')
(u'DVBPR/wd1/Initializer/random_uniform/shape', u'Const')
(u'DVBPR/wd1/Initializer/random_uniform/min', u'Const')
(u'DVBPR/wd1/Initializer/random_uniform/max', u'Const')
(u'DVBPR/wd1/Initializer/random_uniform/RandomUniform', u'RandomUniform')
(u'DVBPR/wd1/Initializer/random_uniform/sub', u'Sub')
(u'DVBPR/wd1/Initializer/random_uniform/mul', u'Mul')
(u'DVBPR/wd1/Initializer/random_uniform', u'Add')
(u'DVBPR/wd1', u'VariableV2')
(u'DVBPR/wd1/Assign', u'Assign')
(u'DVBPR/wd1/read', u'Identity')
(u'DVBPR/MatMul', u'MatMul')
(u'DVBPR/zeros_5/shape_as_tensor', u'Const')
(u'DVBPR/zeros_5/Const', u'Const')
(u'DVBPR/zeros_5', u'Fill')
(u'DVBPR/bd1', u'VariableV2')
(u'DVBPR/bd1/Assign', u'Assign')
(u'DVBPR/bd1/read', u'Identity')
(u'DVBPR/Add', u'Add')
(u'DVBPR/Relu_10', u'Relu')
(u'DVBPR/dropout/keep_prob', u'Const')
(u'DVBPR/wd2/Initializer/random_uniform/shape', u'Const')
(u'DVBPR/wd2/Initializer/random_uniform/min', u'Const')
(u'DVBPR/wd2/Initializer/random_uniform/max', u'Const')
(u'DVBPR/wd2/Initializer/random_uniform/RandomUniform', u'RandomUniform')
(u'DVBPR/wd2/Initializer/random_uniform/sub', u'Sub')
(u'DVBPR/wd2/Initializer/random_uniform/mul', u'Mul')
(u'DVBPR/wd2/Initializer/random_uniform', u'Add')
(u'DVBPR/wd2', u'VariableV2')
(u'DVBPR/wd2/Assign', u'Assign')
(u'DVBPR/wd2/read', u'Identity')
(u'DVBPR/MatMul_1', u'MatMul')
(u'DVBPR/zeros_6/shape_as_tensor', u'Const')
(u'DVBPR/zeros_6/Const', u'Const')
(u'DVBPR/zeros_6', u'Fill')
(u'DVBPR/bd2', u'VariableV2')
(u'DVBPR/bd2/Assign', u'Assign')
(u'DVBPR/bd2/read', u'Identity')
(u'DVBPR/Add_1', u'Add')
(u'DVBPR/Relu_11', u'Relu')
(u'DVBPR/dropout_1/keep_prob', u'Const')
(u'DVBPR/wd3/Initializer/random_uniform/shape', u'Const')
(u'DVBPR/wd3/Initializer/random_uniform/min', u'Const')
(u'DVBPR/wd3/Initializer/random_uniform/max', u'Const')
(u'DVBPR/wd3/Initializer/random_uniform/RandomUniform', u'RandomUniform')
(u'DVBPR/wd3/Initializer/random_uniform/sub', u'Sub')
(u'DVBPR/wd3/Initializer/random_uniform/mul', u'Mul')
(u'DVBPR/wd3/Initializer/random_uniform', u'Add')
(u'DVBPR/wd3', u'VariableV2')
(u'DVBPR/wd3/Assign', u'Assign')
(u'DVBPR/wd3/read', u'Identity')
(u'DVBPR/MatMul_2', u'MatMul')
(u'DVBPR/zeros_7', u'Const')
(u'DVBPR/bd3', u'VariableV2')
(u'DVBPR/bd3/Assign', u'Assign')
(u'DVBPR/bd3/read', u'Identity')
(u'DVBPR/Add_2', u'Add')
(u'DVBPR/random_uniform/shape', u'Const')
(u'DVBPR/random_uniform/min', u'Const')
(u'DVBPR/random_uniform/max', u'Const')
(u'DVBPR/random_uniform/RandomUniform', u'RandomUniform')
(u'DVBPR/random_uniform/sub', u'Sub')
(u'DVBPR/random_uniform/mul', u'Mul')
(u'DVBPR/random_uniform', u'Add')
(u'DVBPR/div/y', u'Const')
(u'DVBPR/div', u'RealDiv')
(u'DVBPR/Variable', u'VariableV2')
(u'DVBPR/Variable/Assign', u'Assign')
(u'DVBPR/Variable/read', u'Identity')
(u'init', u'NoOp')
(u'save/Const', u'Const')
(u'save/SaveV2/tensor_names', u'Const')
(u'save/SaveV2/shape_and_slices', u'Const')
(u'save/SaveV2', u'SaveV2')
(u'save/control_dependency', u'Identity')
(u'save/RestoreV2/tensor_names', u'Const')
(u'save/RestoreV2/shape_and_slices', u'Const')
(u'save/RestoreV2', u'RestoreV2')
(u'save/Assign', u'Assign')
(u'save/Assign_1', u'Assign')
(u'save/Assign_2', u'Assign')
(u'save/Assign_3', u'Assign')
(u'save/Assign_4', u'Assign')
(u'save/Assign_5', u'Assign')
(u'save/Assign_6', u'Assign')
(u'save/Assign_7', u'Assign')
(u'save/Assign_8', u'Assign')
(u'save/Assign_9', u'Assign')
(u'save/Assign_10', u'Assign')
(u'save/Assign_11', u'Assign')
(u'save/Assign_12', u'Assign')
(u'save/Assign_13', u'Assign')
(u'save/Assign_14', u'Assign')
(u'save/Assign_15', u'Assign')
(u'save/Assign_16', u'Assign')
(u'save/restore_all', u'NoOp')
(u'Reshape/tensor', u'Const')
(u'Reshape/shape', u'Const')
(u'Reshape', u'Reshape')
(u'input_code/initial_value', u'Const')
(u'input_code', u'VariableV2')
(u'input_code/Assign', u'Assign')
(u'input_code/read', u'Identity')
(u'Placeholder_2', u'Placeholder')
(u'ResizeNearestNeighbor/size', u'Const')
(u'ResizeNearestNeighbor', u'ResizeNearestNeighbor')
(u'DVBPR_1/Reshape/shape', u'Const')
(u'DVBPR_1/Reshape', u'Reshape')
(u'DVBPR_1/zeros', u'Const')
(u'DVBPR_1/Conv2D', u'Conv2D')
(u'DVBPR_1/BiasAdd', u'BiasAdd')
(u'DVBPR_1/Relu', u'Relu')
(u'DVBPR_1/Relu_1', u'Relu')
(u'DVBPR_1/MaxPool', u'MaxPool')
(u'DVBPR_1/zeros_1', u'Const')
(u'DVBPR_1/Conv2D_1', u'Conv2D')
(u'DVBPR_1/BiasAdd_1', u'BiasAdd')
(u'DVBPR_1/Relu_2', u'Relu')
(u'DVBPR_1/Relu_3', u'Relu')
(u'DVBPR_1/MaxPool_1', u'MaxPool')
(u'DVBPR_1/zeros_2', u'Const')
(u'DVBPR_1/Conv2D_2', u'Conv2D')
(u'DVBPR_1/BiasAdd_2', u'BiasAdd')
(u'DVBPR_1/Relu_4', u'Relu')
(u'DVBPR_1/Relu_5', u'Relu')
(u'DVBPR_1/zeros_3', u'Const')
(u'DVBPR_1/Conv2D_3', u'Conv2D')
(u'DVBPR_1/BiasAdd_3', u'BiasAdd')
(u'DVBPR_1/Relu_6', u'Relu')
(u'DVBPR_1/Relu_7', u'Relu')
(u'DVBPR_1/zeros_4', u'Const')
(u'DVBPR_1/Conv2D_4', u'Conv2D')
(u'DVBPR_1/BiasAdd_4', u'BiasAdd')
(u'DVBPR_1/Relu_8', u'Relu')
(u'DVBPR_1/Relu_9', u'Relu')
(u'DVBPR_1/MaxPool_2', u'MaxPool')
(u'DVBPR_1/Reshape_1/shape', u'Const')
(u'DVBPR_1/Reshape_1', u'Reshape')
(u'DVBPR_1/MatMul', u'MatMul')
(u'DVBPR_1/zeros_5/shape_as_tensor', u'Const')
(u'DVBPR_1/zeros_5/Const', u'Const')
(u'DVBPR_1/zeros_5', u'Fill')
(u'DVBPR_1/Add', u'Add')
(u'DVBPR_1/Relu_10', u'Relu')
(u'DVBPR_1/dropout/keep_prob', u'Const')
(u'DVBPR_1/MatMul_1', u'MatMul')
(u'DVBPR_1/zeros_6/shape_as_tensor', u'Const')
(u'DVBPR_1/zeros_6/Const', u'Const')
(u'DVBPR_1/zeros_6', u'Fill')
(u'DVBPR_1/Add_1', u'Add')
(u'DVBPR_1/Relu_11', u'Relu')
(u'DVBPR_1/dropout_1/keep_prob', u'Const')
(u'DVBPR_1/MatMul_2', u'MatMul')
(u'DVBPR_1/zeros_7', u'Const')
(u'DVBPR_1/Add_2', u'Add')
(u'Placeholder_3', u'Placeholder')
(u'GatherV2/axis', u'Const')
(u'GatherV2', u'GatherV2')
(u'transpose/Rank', u'Rank')
(u'transpose/sub/y', u'Const')
(u'transpose/sub', u'Sub')
(u'transpose/Range/start', u'Const')
(u'transpose/Range/delta', u'Const')
(u'transpose/Range', u'Range')
(u'transpose/sub_1', u'Sub')
(u'transpose', u'Transpose')
(u'MatMul', u'MatMul')
(u'Sum/reduction_indices', u'Const')
(u'Sum', u'Sum')
# get all placeholders in graph
placeholders = [ op for op in sess.graph.get_operations() if op.type == "Placeholder"]
placeholders
[<tf.Operation 'Placeholder' type=Placeholder>,
<tf.Operation 'Placeholder_1' type=Placeholder>,
<tf.Operation 'Placeholder_2' type=Placeholder>,
<tf.Operation 'Placeholder_3' type=Placeholder>]
#define model
with tf.device('/gpu:0'):
#training sample
queueu = tf.placeholder(dtype=tf.int32,shape=[1])
queuei = tf.placeholder(dtype=tf.int32,shape=[1])
queuej = tf.placeholder(dtype=tf.int32,shape=[1])
queueimage1 = tf.placeholder(dtype=tf.uint8,shape=[224,224,3])
queueimage2 = tf.placeholder(dtype=tf.uint8,shape=[224,224,3])
batch_train_queue = tf.FIFOQueue(batch_size*5, dtypes=[tf.int32,tf.int32,tf.int32,tf.uint8,tf.uint8], shapes=[[1],[1],[1],[224,224,3],[224,224,3]])
batch_train_queue_op = batch_train_queue.enqueue([queueu,queuei,queuej,queueimage1,queueimage2]);
u,i,j,image1,image2 = batch_train_queue.dequeue_many(batch_size)
image_test=tf.placeholder(dtype=tf.uint8,shape=[batch_size,224,224,3])
最佳答案
好问题。一、feed_dict
只是一条 python dictionary其中每个键都是一个 tf.placeholder
每个对应的值都是一个 python 对象。该对象的形状必须与相应占位符的形状相同,并且必须具有可以强制转换为占位符 dtype
的数据类型. feed_dict
的结构由图的结构决定,因为图中的每个占位符都必须有一个字典键值元组。
要获取图表中的所有占位符,可以使用以下单行:
placeholders = [ op for op in graph.get_operations() if op.type == "Placeholder"]
placeholders
来工作。如果操作类型为
"Placeholder"
.
关于python-2.7 - 理解 sess.run 中的 feed_dict,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51253483/
在 tensorflow 中,如果我们想要运行多个操作,如果我们将列表中的操作传递给单个 sess.run() 与我们使用多个 sess.run() 但只向每个操作传递一个操作? 示例: #!/usr
我尝试通过以下代码来训练我的模型。 sess.run([train_op, model.global_step, model.loss, model.prediction], feed_dict) 但
我正在训练 CNN,我相信我使用了 sess.run()导致我的训练速度非常慢。 本质上,我使用 mnist数据集... from tensorflow.examples.tutorials.mnis
我有一些扩展名为 *.sess 的 session 文件。如何在 Linux/Windows 上打开它?我尝试使用普通的文本编辑器,但我得到了部分垃圾值和部分实际文本。谢谢! 最佳答案 我希望您正在尝
使用 tf print documentation 我写的 print_op = tf.print("tensors:", cut_points[0,0,:], output_stream=s
我正在尝试向我的神经网络提供存储在 TFRecords 中的数据。数据是使用 inputs() 提取的,与 tensorflow 网页上的提取方式类似。它返回的数据是两个张量。当我尝试eval()张量
我想对单个 sess.run() 调用执行多个梯度下降步骤。每次调用的输入都是固定的,因此我只需要传递一次。 我该怎么做?我有一个想法,但我不确定它是否会在每一步重新计算梯度(而是应用第一个梯度 N
我在 Koa 中使用 Passport.js,我注意到当生成 session cookie 时,它被称为 koa:sess并包含编码为 Base64 的 session 信息。然而,还有另一个 c
我正在测试tensorflow队列系统,并且我有一个简单的tensorflow程序,它使用队列来处理输入。示例程序代码为 import tensorflow as tf import numpy as
我正在尝试逐批训练我的模型,因为我找不到任何示例来说明如何正确地训练它。这是我所能做的,我的任务是找到如何在 Tensorflow 中逐批训练模型。 queue=tf.FIFOQueue(capaci
我试着玩了一下 tensorflow,但似乎我做错了什么,我制作的小程序: import tensorflow as tf x = tf.placeholder(tf.float64) y = tf.
我是 Tensorflow 新手,遇到了一个问题。当我的程序到达 x_batch = sess.run(X_mb) 时,它被卡住了(因此,它可以打印 1 和 2,但无法打印 4。我猜这是一个无限循环)
我一直以为变量赋值是在给sess.run的列表中的所有操作之后完成的,但是下面的代码在不同的执行中返回不同的结果。似乎随机运行列表中的操作并在列表中的操作运行后分配变量。 a = tf.Variabl
所以,这可能是一个愚蠢或显而易见的问题,但请耐心等待。我是一名数学专业的学生,我已经进入最后一年了,一直在学习使用神经网络来取乐。我不是程序员,所以错误是我经常遇到的事情。通常我可以把它们整理出来
我在 tensorflow 下运行 python 程序。当我输入sess.run()时,命令行提示我NameError: name 'sess' is not defined print(sess.r
我在 Python v2.7 中使用 tensorflow 0.8.0。我的 IDE 是 PyCharm,我的操作系统是 Linux Ubuntu 14.04 我注意到以下代码会导致我的计算机死机和/
下面的代码会挂起(只有 CTRLz 让我退出)。 import tensorflow as tf import cifar10 # from https://github.com/tensorflow
sess.graph 和 tf.get_default_graph() 在 tensorboard 中给出相同的结果。根据手册,我不太清楚它们之间有什么区别。有人可以帮忙解释一下区别吗? anybob
这些帖子确实有数千篇,但我还没有看到一篇能解决我的确切问题的帖子。如果存在,请随时关闭。 我知道列表在 Python 中是可变的。因此,我们不能将列表存储为字典中的键。 我有以下代码(因为不相关而省略
我是 tensorflow 的新手。我有一些我想理解的代码。有没有办法在 sess.run 中获取“feed_dict”的所有可能输入的列表? feed_dict 的结构是始终相同还是取决于 sess
我是一名优秀的程序员,十分优秀!