0
功能:
def evaluation(logits, labels):
correct = tf.nn.in_top_k(logits, labels, 1)
return tf.reduce_sum(tf.cast(correct, tf.int32))
結束
問:
如何在張打印值「標籤」或「 logits」,當我運行 的代碼如下:如何打印在tensorflow張量的值,當我在調試
python -m pdb fully_connected_feed.py
fully_connected_feed.py(16)<module>()
-> """Trains and Evaluates the MNIST network using a feed dictionary."""
(Pdb) b network.py:194
Breakpoint 1 at network.py:194
(Pdb) c
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcurand.so locally
network.py(194)evaluation()
-> correct = tf.nn.in_top_k(logits, labels, 1)
(Pdb) logits
<tf.Tensor 'softmax_linear/add:0' shape=(100, 4382) dtype=float32>
謝謝!它的工作原理~~ –
當然!如果沒問題,請在解決問題時點擊支票。謝謝! – Jin