numpy - 如何在 tensorflow 中打印完整(未截断)的张量?

标签 numpy tensorflow

每当我尝试打印时,结果总是被截断

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)

如您所见,我遵循了在 Print full value of tensor into console or write to file in tensorflow 上找到的指南

但是输出很简单

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

我想查看完整的张量,谢谢。

最佳答案

通过检查 the Tensorflow API 可以轻松解决此问题对于tf.Print。传递 summarize=n,其中 n 是要显示的元素数量。

关于numpy - 如何在 tensorflow 中打印完整(未截断)的张量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49429733/

相关文章:

python - 如何使用horovod对正常值进行allreduce运算?

python - 返回单元素 Numpy 数组的简洁方法

Python 错误 : len() of unsized object while using statsmodels with one row of data

python - 使用 python scipy.optimize.minimize 时如何确保解决方案是全局最小值

python - 对两个列表进行排序——一个是列表的列表

tensorflow - 在 google colab 中,有没有办法检查正在运行的 GPU 版本?

react-native - 使用 React Native 和 Tensorflow.js 对实时视频进行预测

tensorflow - 如何使用孪生网络保存、恢复、预测(带有三元组损失)

python - RuntimeError : tf. placeholder() 与急切执行不兼容

python - 如果默认列中的行为 NaN,如何从数据框中的其他列中选择行?