我需要将一个大张量 ([32,32,3]) 打印到控制台中,并且我只得到如下输出:
[[[245 245 245]
[245 245 245]
[245 245 245]
...,
[245 245 245]
[245 245 245]
[245 245 245]]
[[245 245 245]
[245 245 245]
[245 245 245]
...,
[245 245 245]
[245 245 245]
[245 245 245]]
[[245 245 245]
[245 245 245]
[245 245 245]
...,
[245 245 245]
[245 245 245]
[245 245 245]]
...,
[[245 245 245]
[245 245 245]
[245 245 245]
...,
[245 245 245]
[245 245 245]
[245 245 245]]
[[245 245 245]
[245 245 245]
[245 245 245]
...,
[245 245 245]
[245 245 245]
[245 245 245]]
[[245 245 245]
[245 245 245]
[245 245 245]
...,
[245 245 245]
[245 245 245]
[245 245 245]]]
如何让张量流打印出整个张量,而不是用省略号截断它?
从 TensorFlow 返回的值Session.run() https://www.tensorflow.org/versions/master/api_docs/python/client.html#Session.runcall 是一个 NumPy ndarray,所以这个渲染是由 NumPy 本身控制的。确保打印所有元素的一种简单方法是使用numpy.set_printoptions() http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.set_printoptions.html:
import numpy
numpy.set_printoptions(threshold=numpy.nan)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)