Python E1120:参数'没有值;y';Tensorflow上的函数内调用
我正在用tensorflow构建一个神经网络,这是我正在使用的代码-Python E1120:参数'没有值;y';Tensorflow上的函数内调用,python,python-3.x,tensorflow,Python,Python 3.x,Tensorflow,我正在用tensorflow构建一个神经网络,这是我正在使用的代码- 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 =
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(行)的行显示错误“E1120:函数调用中参数“y”没有值”。
我在vscode上使用pytlint linter。也许这是一个过梁问题。
有人对如何解决这个问题有什么建议吗?函数add有两个参数
在
tf.add(tf.matmul(data,hidden_layer_1['weights'])+hidden_layer_1['biases'])
行中,您试图使用函数add
并同时使用+
。执行
tf.add(tf.matmul(数据,隐藏层1['weights')、隐藏层1['biases'))
或
tf.matmul(数据,隐藏层1['weights'))+隐藏层1['biases']
编译时是否有任何错误