How to print full (not truncated) tensor in tensorflow?

狂风中的少年 提交于 2021-02-18 10:29:09

问题


Whenever I try printing I always get truncated results

import tensorflow as tf
import numpy as np

np.set_printoptions(threshold=np.nan)

tensor = tf.constant(np.ones(999))

tensor = tf.Print(tensor, [tensor])

sess = tf.Session()

sess.run(tensor)

As you can see I've followed a guide I found on Print full value of tensor into console or write to file in tensorflow

But the output is simply

...\core\kernels\logging_ops.cc:79] [1 1 1...]

I want to see the full tensor, thanks.


回答1:


This is solved easily by checking the Tensorflow API for tf.Print. Pass summarize=n where n is the number of elements you want displayed.



来源:https://stackoverflow.com/questions/49429733/how-to-print-full-not-truncated-tensor-in-tensorflow

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!