+ (1 - y) * tf.log(tf.clip_by_value(1 - y, 1e-10, 1.0))) 中第一个(1 - y)应改为(1 - y_)
softmax输出公式中yi,yj的i,j应为下标
print tf.matmul(v1, v2).eval()这一页还有其他两个类似的问题1.一个是print应该注明一下是在python2下运行的(书中好多处都是用的python的print语法)2.tf.matmul(v1, v2).eval()单独这样写是有问题的,可能是书中省略了,但应该要说明一下,或者详细一点:import tensorflow as tfv1 = tf.constant([[1.0, 2.0],[3.0, 4.0]])v2 = tf.constant([[5.0, 6.0],[7.0, 8.0]])sess = tf.Session()print(tf.matmul(v1, v2).eval(session=sess))像这样,像我这种小白一开始不知道,还以为代码错了,希望能改进。
print(sess.run(w1)) 应该顶格。
代码最后一行print sess.run(w1)一个是print的语法问题,在python下应为print()还有一个是print语句的缩进问题,应该与for的缩进相同
+ (1 - y) * tf.log(tf.clip_by_value(1 - y, 1e-10, 1.0))) 中第一个(1 - y)应改为(1 - y_)
softmax输出公式中yi,yj的i,j应为下标
print tf.matmul(v1, v2).eval()这一页还有其他两个类似的问题
1.一个是print应该注明一下是在python2下运行的(书中好多处都是用的python的print语法)
2.tf.matmul(v1, v2).eval()单独这样写是有问题的,可能是书中省略了,但应该要说明一下,或者详细一点:
import tensorflow as tf
v1 = tf.constant([[1.0, 2.0],[3.0, 4.0]])
v2 = tf.constant([[5.0, 6.0],[7.0, 8.0]])
sess = tf.Session()
print(tf.matmul(v1, v2).eval(session=sess))
像这样,像我这种小白一开始不知道,还以为代码错了,希望能改进。
print(sess.run(w1)) 应该顶格。
代码最后一行print sess.run(w1)
一个是print的语法问题,在python下应为print()
还有一个是print语句的缩进问题,应该与for的缩进相同