代码
maskkkkk
这个作者很懒,什么都没留下…
展开
-
解决tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot assign a device for operation
错误如下图所示:在代码中添加如下两行即可:config = tf.ConfigProto(allow_soft_placement = True)sess = tf.Session(config = config)原创 2019-01-05 11:40:27 · 9798 阅读 · 2 评论 -
关于神经网络中的shape问题
1.矩阵相乘神经网络参考:https://blog.csdn.net/machinerandy/article/details/79632748#commentBox但对上文中最后一句“并且对于最终全连接的单输出节点YY得到的结果也由Y1×10→Y10×1Y1×10→Y10×1。 ”,持保留意见。tensorflow中,使用的代码是output = tf.matmul(...原创 2019-03-26 21:44:49 · 3620 阅读 · 0 评论 -
解决ValueError: Shape of a new variable (fc1/weights) must be fully defined, but instead was (?, 1500)
构建计算图的逻辑没有问题。但运行会话时,出现了这个错误。解决办法:将placeholder里的维数都设置成定值,不要用None表示样本sample的数量。原创 2019-04-22 09:48:34 · 1324 阅读 · 0 评论 -
解决ValueError: Shapes (?,) and (28, 28) are not compatible和InvalidArgumentError (see above for traceb
背景:发生在读取tfrecords文件时。情况不一样的话,可以不用往下看了。在读取tfrecords文件的时候,有这么一段代码。image = tf.decode_raw(features['image_raw'], tf.uint8) # 按照uint8去解析image.set_shape([784]) # 1*784image = tf.cast(image, tf.flo...原创 2019-04-20 15:56:26 · 3585 阅读 · 0 评论