小编kev*_*oon的帖子

ValueError:没有为任何变量提供渐变

我正面临着tensorFlow的麻烦.执行以下代码

import tensorflow as tf
import input_data

learning_rate = 0.01
training_epochs = 25
batch_size = 100
display_step = 1

mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)

# tensorflow graph input
X = tf.placeholder('float', [None, 784]) # mnist data image of shape 28 * 28 = 784
Y = tf.placeholder('float', [None, 10]) # 0-9 digits recognition = > 10 classes

# set model weights
W = tf.Variable(tf.zeros([784, 10]))
b = tf.Variable(tf.zeros([10]))

# Our hypothesis
activation = tf.add(tf.matmul(X, W),b)  # Softmax

# Cost function: cross …
Run Code Online (Sandbox Code Playgroud)

tensorflow

13
推荐指数
2
解决办法
1万
查看次数

标签 统计

tensorflow ×1