資源簡介
代碼片段和文件信息
“““
demo01_ce.py?交叉熵
“““
import?tensorflow?as?tf
label?=?[1.?0.?0.]
logit1?=?[10.?3.?3.]
logit2?=?[10.?-3.?-5.]
ce1?=?tf.nn.sigmoid_cross_entropy_with_logits(
labels=label?logits=logit1)
ce2?=?tf.nn.sigmoid_cross_entropy_with_logits(
labels=label?logits=logit2)
#?模擬真實(shí)情況
y?=?[[1.?0.?0.]?[0.?0.?1.]?[0.?0.?1.]]
y_?=?[[0.8?0.1?0.1]?
??[0.2?0.2?0.6]?
??[0.2?0.1?0.7]]
CE?=?tf.nn.sigmoid_cross_entropy_with_logits(
labels=y?logits=y_)
SM?=?tf.nn.softmax_cross_entropy_with_logits(
labels=y?logits=y_)
with?tf.Session()?as?sess:
print(sess.run(ce1).mean())
print(sess.run(ce2).mean())
print(sess.run(CE).sum(axis=1))
print(sess.run(SM))
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-12-09?09:45??day18\
?????文件?????????437??2019-11-22?17:16??day18\8.png
?????目錄???????????0??2019-11-22?19:43??day18\MNIST_data\
?????文件?????1648877??2019-11-22?15:59??day18\MNIST_data\t10k-images-idx3-ubyte.gz
?????文件?????7840016??1998-01-26?23:07??day18\MNIST_data\t10k-images.idx3-ubyte
?????文件????????4542??2019-11-22?15:59??day18\MNIST_data\t10k-labels-idx1-ubyte.gz
?????文件???????10008??1998-01-26?23:07??day18\MNIST_data\t10k-labels.idx1-ubyte
?????文件?????9912422??2019-11-22?15:59??day18\MNIST_data\train-images-idx3-ubyte.gz
?????文件????47040016??1996-11-18?23:36??day18\MNIST_data\train-images.idx3-ubyte
?????文件???????28881??2019-11-22?15:59??day18\MNIST_data\train-labels-idx1-ubyte.gz
?????文件???????60008??1996-11-18?23:36??day18\MNIST_data\train-labels.idx1-ubyte
?????文件??????????89??2019-11-22?20:18??day18\checkpoint
?????文件?????????739??2019-11-22?10:53??day18\demo01_ce.py
?????文件????????2507??2019-11-22?11:40??day18\demo02_tfdemo.py
?????文件????????2467??2019-11-22?18:56??day18\demo03_mnist.py
?????文件????????2606??2019-12-09?09:45??day18\demo04_mnist_test.py
?????文件????13098536??2019-11-22?20:18??day18\mnist_model.ckpt.data-00000-of-00001
?????文件?????????339??2019-11-22?20:18??day18\mnist_model.ckpt.index
?????文件???????56562??2019-11-22?20:18??day18\mnist_model.ckpt.me
?????文件???????24538??2019-11-22?11:31??day18\神經(jīng)網(wǎng)絡(luò)分類模型_初始.png
?????文件???????21301??2019-11-22?11:32??day18\神經(jīng)網(wǎng)絡(luò)分類模型_結(jié)果.png
評論
共有 條評論