我正在用张量流构建神经网络,这是我正在使用的代码-
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("/tmp/data", one_hot = True)
n_nodes_hl1 = 500
n_nodes_hl2 = 500
n_nodes_hl3 = 500
n_classes = 10
batch_size = 100
x = tf.placeholder('float', [None, 784])
y = tf.placeholder('float')
def neural_network_model(data):
hidden_layer_1 = {'weights': tf.Variable(tf.random_normal(784,n_nodes_hl1)),
'biases': tf.Variable(tf.random_normal(n_nodes_hl1))}
hidden_layer_2 = {'weights': tf.Variable(tf.random_normal(n_nodes_hl1, n_nodes_hl2)),
'biases': tf.Variable(tf.random_normal(n_nodes_hl2))}
hidden_layer_3 = {'weights': tf.Variable(tf.random_normal(n_nodes_hl2, n_nodes_hl3)),
'biases': tf.Variable(tf.random_normal(n_nodes_hl3))}
output_layer = {'weights': tf.Variable(tf.random_normal(n_nodes_hl3, n_classes)),
'biases': tf.Variable(tf.random_normal(n_classes))}
l1 = tf.add(tf.matmul(data,hidden_layer_1['weights']) + hidden_layer_1['biases'])
l1 = tf.nn.relu(l1)
l2 = tf.add(tf.matmul(l1, hidden_layer_2['weights']) + hidden_layer_2['biases'])
l2 = tf.nn.relu(l2)
l3 = tf.add(tf.matmul(l2, hidden_layer_3['weights']) + hidden_layer_3['biases'])
l3 = tf.nn.relu(l3)
output = tf.matmul(l3, output_layer['weights'] + output_layer['biases'])
return output
tf.add(lines)所在的行显示错误“ E1120:函数调用中的参数“ y”没有值”。我在vscode上使用pytlint linter。可能是一个小问题。有没有人有任何建议如何解决这个问题
相关分类