【发布时间】:2018-01-06 14:06:09
【问题描述】:
没有placeholders 和feed_dict 有没有简单的方法打印dtype=float32 的值?这个过程很尴尬,需要为每个操作单独定义。假设我有具有数百个操作的 inceptionv3 模型:
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>,)
有没有一种简单的方法可以一次打印所有这些浮点类型的值?
【问题讨论】:
标签: python tensorflow type-conversion