1
是否有簡便的方法可以打印dtype=float32
的值而不需要placeholders
和feed_dict
?這個過程很尷尬,需要爲每個操作單獨定義。說我有inceptionv3
模型與數百名操作:Tensorflow中所有dtype = float32的打印值(權重)
op = sess.graph.get_operations()
for m in op :
print(m.values())
這些和他們中的一些混合:
...
(<tf.Tensor 'pool_3:0' shape=(?, ?, ?, 2048) dtype=float32>,)
(<tf.Tensor 'pool_3/_reshape/shape:0' shape=(2,) dtype=int32>,)
(<tf.Tensor 'pool_3/_reshape:0' shape=(1, 2048) dtype=float32>,)
(<tf.Tensor 'softmax/weights_quint8_const:0' shape=(2048, 1008) dtype=quint8>,)
(<tf.Tensor 'softmax/weights_min:0' shape=() dtype=float32>,)
(<tf.Tensor 'softmax/weights_max:0' shape=() dtype=float32>,)
(<tf.Tensor 'softmax/logits/MatMul_eightbit_reshape_dims:0' shape=(1,) dtype=int32>,)
(<tf.Tensor 'softmax/logits/MatMul_eightbit_reduction_dims:0' shape=(1,) dtype=int32>,)
(<tf.Tensor 'softmax/logits/MatMul_eightbit_reshape_pool_3/_reshape:0' shape=(2048,) dtype=float32>,)
(<tf.Tensor 'softmax/logits/MatMul_eightbit_min_pool_3/_reshape:0' shape=() dtype=float32>,)
(<tf.Tensor 'softmax/logits/MatMul_eightbit_max_pool_3/_reshape:0' shape=() dtype=float32>,)
(<tf.Tensor 'softmax/logits/MatMul_eightbit_quantize_pool_3/_reshape:0' shape=(1, 2048) dtype=quint8>, <tf.Tensor 'softmax/logits/MatMul_eightbit_quantize_pool_3/_reshape:1' shape=() dtype=float32>, <tf.Tensor 'softmax/logits/MatMul_eightbit_quantize_pool_3/_reshape:2' shape=() dtype=float32>)
(<tf.Tensor 'softmax/logits/MatMul_eightbit_quantized_bias_add:0' shape=(1, 1008) dtype=qint32>, <tf.Tensor 'softmax/logits/MatMul_eightbit_quantized_bias_add:1' shape=() dtype=float32>, <tf.Tensor 'softmax/logits/MatMul_eightbit_quantized_bias_add:2' shape=() dtype=float32>)
(<tf.Tensor 'softmax/logits/MatMul_eightbit_quantize_down:0' shape=(1, 1008) dtype=quint8>, <tf.Tensor 'softmax/logits/MatMul_eightbit_quantize_down:1' shape=() dtype=float32>, <tf.Tensor 'softmax/logits/MatMul_eightbit_quantize_down:2' shape=() dtype=float32>)
(<tf.Tensor 'softmax/biases_quint8_const:0' shape=(1008,) dtype=quint8>,)
(<tf.Tensor 'softmax/biases_min:0' shape=() dtype=float32>,)
(<tf.Tensor 'softmax/biases_max:0' shape=() dtype=float32>,)
(<tf.Tensor 'softmax/logits_eightbit_quantized_bias_add:0' shape=(1, 1008) dtype=qint32>, <tf.Tensor 'softmax/logits_eightbit_quantized_bias_add:1' shape=() dtype=float32>, <tf.Tensor 'softmax/logits_eightbit_quantized_bias_add:2' shape=() dtype=float32>)
(<tf.Tensor 'softmax/logits_eightbit_quantize_down:0' shape=(1, 1008) dtype=quint8>, <tf.Tensor 'softmax/logits_eightbit_quantize_down:1' shape=() dtype=float32>, <tf.Tensor 'softmax/logits_eightbit_quantize_down:2' shape=() dtype=float32>)
(<tf.Tensor 'softmax/logits:0' shape=(1, 1008) dtype=float32>,)
(<tf.Tensor [] shape=(1, 1008) dtype=float32>,)
有沒有一種簡單的方法,在一次打印所有這些浮點類型的值?
感謝@ user1735003,這將打印有'的操作只有D型= float32':這裏是我的輸出:' ..., , ]' 現在,我將如何能夠打印它們的值? –
Amir
@Amir我更新了我的答案,指出您需要在會話中運行輸出以獲取其值。 – user1735003
非常感謝,@ user1735003。這回到我現在的第一個問題!我們如何定義'feed_dict'對於所有具有不同形狀的不同浮點類型是通用的:D – Amir