Python tf.nn.sigmoid_交叉_熵_与_物流公司讨论文档中的论点

Python tf.nn.sigmoid_交叉_熵_与_物流公司讨论文档中的论点,python,python-2.7,machine-learning,tensorflow,deep-learning,Python,Python 2.7,Machine Learning,Tensorflow,Deep Learning,所以我有下面的模型,我想用它来测试一个想法。我特别感兴趣,因为我的标签不是相互排斥的 import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', one_hot=True) x = tf.placeholder(tf.float32, shape=[None, 784]) y_ = tf.p

所以我有下面的模型,我想用它来测试一个想法。我特别感兴趣,因为我的标签不是相互排斥的

import tensorflow as tf

from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)

x  = tf.placeholder(tf.float32, shape=[None, 784])
y_ = tf.placeholder(tf.float32, shape=[None, 10])

w1 = tf.get_variable("w1", shape=[784, 512], initializer=tf.contrib.layers.xavier_initializer())
b1 = tf.Variable(tf.zeros([512], dtype=tf.float32))
w2 = tf.Variable(tf.zeros([512, 10], dtype=tf.float32))
b2 = tf.Variable(tf.zeros([10], dtype=tf.float32))

h = tf.nn.relu(tf.matmul(x, w1) + b1)
y = tf.matmul(h, w2) + b2

cross_entropy = tf.nn.sigmoid_cross_entropy_with_logits(labels=y_, logits=y)
train_step = tf.train.AdamOptimizer().minimize(cross_entropy)

with tf.Session() as sess:

    sess.run(tf.initialize_all_variables())
    start = time.time()

    for i in range(20000):
        batch = mnist.train.next_batch(50)
        train_step.run(feed_dict={x: batch[0], y_: batch[1]})
然而,我反复得到以下错误,这似乎与张量流文档相矛盾

Traceback (most recent call last):
File "mnist_test.py", line 19, in <module>
cross_entropy = tf.nn.sigmoid_cross_entropy_with_logits(labels=y_, logits=y)
TypeError: sigmoid_cross_entropy_with_logits() got an unexpected keyword argument 'labels'
回溯(最近一次呼叫最后一次):
文件“mnist_test.py”,第19行,在
交叉熵=tf.nn.sigmoid交叉熵(标签=y,logits=y)
TypeError:sigmoid\u cross\u entropy\u with\u logits()获得意外的关键字参数“labels”

请帮忙

TensorFlow 1.0.0及更高版本中的关键字参数
标签
。我猜您使用的是0.12或更低。使用
pip freeze
print('TensorFlow version:{0}'。格式(tf.\uu version\uuuu))
进行检查


有关以前版本的文档,请访问


要在以前版本的文档中搜索某些信息,您可以使用:

是否有人可以提供指向旧tensor flow文档的链接?“我在他们的网站上找不到。”约书亚·霍华德补充道