
TensorFlow
yyhhlancelot
心之所向,素履以往。
展开
-
tensorflow.python.framework.errors_impl.UnknownError: Failed to WriteFile: ... Unknown error
tensorflow.python.framework.errors_impl.UnknownError: Failed to WriteFile: C:\Users\YYHHLA~1\AppData\Local\Temp\tmpwh5slvw2\graph.pbtxt.tmpa1197ad670c9472fa48820c69ea9628f : \udcb4\udcc5\udcc5\u033f\u...原创 2018-07-17 15:10:42 · 4571 阅读 · 1 评论 -
个人总结:CNN、tf.nn.conv2d(卷积)与 tf.nn.conv2d_transpose(反卷积)
为什么出现了卷积神经网络假如有一幅1000x1000的图像,如果把整副图片作为特征进行输入的话,向量的长度为1000000。假设使用普通的NN来对图像进行训练。假设隐藏层的神经元个数和输入一样,也是1000000;那么,从输入层到隐藏层的参数数据量有10^6 x 10^6 = 10^12,实在是太高了。局部连接局部感受野:一般认为人对外界的认知是从局部到全局。因此每个神经元没有...原创 2018-10-09 16:33:57 · 1933 阅读 · 0 评论 -
Tensorflow报错:ValueError: Trying to share variable ..., but specified shape ... and found shape ...
Tensorflow报错:ValueError: Trying to share variable CON/conv2/W, but specified shape (3, 3, 128, 256) and found shape (3, 3, 128, 128).我的使用情景是这样的:我在一个卷积层提供了一个filter,并且它的shape为(3, 3, 128, 256), 然后我通过...原创 2018-10-09 11:11:32 · 7817 阅读 · 0 评论 -
TensorFlow 报错:unhashable type: 'numpy.ndarray' error 的可能错因
一般来说是sess.run里的feed_dict字典内部出现了问题。feed_dict的参数一般存放的是占位符placeholder,通过feed_dict将具体数据“喂”进placeholder。unhashable type: 'numpy.ndarray' error报了这样的错,极有可能是因为feed_dict的内部的键(placeholder)与值不匹配。通过上网查阅以及我个人出现的...原创 2018-10-11 10:06:41 · 3548 阅读 · 1 评论 -
TypeError: Failed to convert object of type class 'builtin_function_or_method' to Tensor. Contents
TensorFlow 报错:TypeError: Failed to convert object of type <class 'builtin_function_or_method'> to Tensor. Contents: <built-in function input>. Consider casting elements to a supported type...原创 2018-08-06 10:39:11 · 9975 阅读 · 0 评论 -
tf.concat 报错 TypeError: Expected int32...
tensorflow在老版本中tf.concat的参数设置为tf.concat(concat_dim, values, name = 'concat')而在新版本(1.3.0)后换为了tf.concat(values, concat_dim, name = 'concat')所以只需将前两维的位置换下,也许就不会报错了。例如,将原来的x1 = tf.Variable(...原创 2018-08-01 16:06:45 · 1417 阅读 · 0 评论 -
tf.clip_by_value(t, clip_value_min, clip_value_max, name = None)
tf.clip_by_value是tensorflow中类似于numpy.clip的操作,会返回一个clip的op。也就是说,对于张量t中小于clip_value_min的值使其等于clip_value_min,大于clip_value_max的使其等于clip_value_max。写这篇博文的原因是看了很多博客中写的参数都是min和max,其实这是不准确的。代入的时候就会报错Type...原创 2018-08-10 10:20:53 · 644 阅读 · 0 评论 -
tf.global_variables_initializer()与tf.local_variables_initializer()的区别
一、tf.global_variables_initializer()tf.global_variables_initializer()添加节点用于初始化所有的变量(GraphKeys.VARIABLES)。返回一个初始化所有全局变量的操作(Op)。在你构建完整个模型并在会话中加载模型后,运行这个节点。能够将所有的变量一步到位的初始化,非常的方便。通过feed_dict, 你也可以将指定的...原创 2018-08-04 20:58:58 · 21057 阅读 · 1 评论 -
TensorFlow训练GAN时, 关于“tf.matmul(z, G_W1) + G_b1” 为何矩阵能和向量相加的实验探索
在tensorflow中,若将矩阵[m, n]与向量[m, 1]或者[1, n]相加时,会将向量扩展为与矩阵相同的维度,扩展的方式为将那一行或那一列进行复制。这符合我们训练神经网络的方式,通过将偏置进行扩展,与之前输入与权重矩阵之乘积相加。附上实验验证代码:import tensorflow as tfa = tf.get_variable("a", [3, 5])b = tf...原创 2018-07-19 21:50:33 · 415 阅读 · 0 评论 -
TensorFlow中的tf.batch_matmul()
如果有两个三阶张量,size分别为a.shape = [100, 3, 4]b.shape = [100, 4, 5]c = tf.batch_matmul(a, b)则c.shape = [100, 3, 5] //将每一对 3x4 的矩阵与 4x5 的矩阵分别相乘。batch_size不变100为张量的batch_size。剩下的两个维度为数据的维度。不过新版的ten...原创 2018-07-24 20:44:15 · 7460 阅读 · 0 评论 -
ValueError : Cannot evaluate tensor using 'eval' : No default session is registered.
大家在学习tensorflow可能遇到 train_accuracy = accuracy.eval(feed_dict={ x: mnist.test.images, y_: mnist.test.labels, keep_prob: 1.0})报了这样的错ValueError: Cannot evaluate tensor using `eval...原创 2018-07-19 09:39:16 · 2311 阅读 · 1 评论 -
TypeError: run() missing 1 required positional argument: 'fetches'
如果尝试 from tensorflow import Session as sess则可能报这样的错。因为sess实际上为tf.Session(),请注意括号。但是如果是from tensorflow import Session()as sess,则没有这样的语义,同样会报错。为了避免各种各样奇怪的错误,应该写为sess = tf.Session()或写为 with t...原创 2018-07-17 20:11:18 · 11429 阅读 · 0 评论 -
Tensorflow报错:ValueError: Stride must be > 0, but got 0 for '...' with input shapes: [...], [...]
完整错误报错为:ValueError: Stride must be > 0, but got 0 for 'gradients/CON/de_conv8/conv2d_transpose_grad/Conv2D' (op: 'Conv2D') with input shapes: [96,16,16,128], [4,4,128,256].tensorflow检测到我的strides输...原创 2018-10-10 20:41:57 · 1635 阅读 · 0 评论