TrickyGo / Dive-into-DL-TensorFlow2.0

本项目将《动手学深度学习》(Dive into Deep Learning)原书中的MXNet实现改为TensorFlow 2.0实现,项目已得到李沐老师的认可
https://trickygo.github.io/Dive-into-DL-TensorFlow2.0/#/
Apache License 2.0
3.78k stars 820 forks source link

6.4网页版和github上面的结果不一致 #53

Open aesdhj opened 4 years ago

aesdhj commented 4 years ago

github 网页版 6.4网页版和github上面的结果不一致,代码一致,疑惑,另外6.3vocab_size实际2582,网页版和github上面是1027,如果上述有描述错误,望指教。

sunshine-zkf commented 4 years ago

github 网页版 6.4网页版和github上面的结果不一致,代码一致,疑惑,另外6.3vocab_size实际2582,网页版和github上面是1027,如果上述有描述错误,望指教。

损失函数缺少一个参数指定为 from_logits = True,因为全连接层没有使用softmax激活函数,需要在这指定这个参数为True。 l = tf.reduce_mean(tf.losses.sparse_categorical_crossentropy(y,outputs,from_logits=True))