解决tensorflow打印tensor有省略号的问题

作者:独孤的大山猫 时间:2022-12-13 09:22:09 

先上代码:


import tensorflow as tf
x = tf.ones(shape=[100, 200], dtype=tf.int32, name='x')
y = tf.zeros(shape=[2, 3], dtype=tf.float32, name='y')
with tf.Session() as sess:
 print(sess.run([x, y]))

输出结果如下:

解决tensorflow打印tensor有省略号的问题

如果我调试的时候想查看省略号代表的值是什么

只需要改成如下代码就行:


import tensorflow as tf
import numpy as np #借助numpy模块的set_printoptions()函数,将打印上限设置为无限即可
np.set_printoptions(threshold=np.inf)
x = tf.ones(shape=[10, 20], dtype=tf.int32, name='x')
y = tf.zeros(shape=[2, 3], dtype=tf.float32, name='y')
with tf.Session() as sess:
 print(sess.run(x, y))

输出结果如下:可以看到省略号的部分也都打出来了

解决tensorflow打印tensor有省略号的问题

来源:https://blog.csdn.net/xiqi4145/article/details/89293994

标签:tensorflow,tensor,省略号
0
投稿

猜你喜欢

  • SqlServer开发神器'SQLPrompt'插件的使用详解

    2024-01-23 23:48:55
  • 小xiao说说创意图标设计心得

    2009-11-18 12:27:00
  • python模块导入的细节详解

    2021-01-09 19:18:08
  • Python Pandas的concat合并

    2023-06-08 05:05:38
  • MySQL order by与group by查询优化实现详解

    2024-01-24 23:27:48
  • 基于python利用Pyecharts使高清图片导出并在PPT中动态展示

    2021-02-23 13:02:39
  • 一个输入框提示列表效果

    2008-03-09 18:53:00
  • pytorch绘制并显示loss曲线和acc曲线,LeNet5识别图像准确率

    2023-01-06 11:04:09
  • Yii开启片段缓存的方法

    2023-11-21 05:00:40
  • 怎样写好commit message提高业务效率

    2023-09-20 06:06:40
  • 完美解决ARIMA模型中plot_acf画不出图的问题

    2023-07-13 14:17:34
  • Python中实现ipaddress网络地址的处理

    2023-12-04 16:43:38
  • Github Copilot结合python的使用方法详解

    2023-07-24 20:53:11
  • 图文详解Python中最神秘的一个魔法函数

    2022-03-25 05:44:24
  • php+jQuery实现的三 级导航栏下拉菜单显示效果

    2023-11-14 12:32:05
  • vue+elementUI动态生成面包屑导航教程

    2024-05-02 17:12:26
  • Python去除字符串前后空格的几种方法

    2021-12-22 02:10:02
  • Python中sub()的用法说明

    2023-08-04 14:29:32
  • python mysql自增字段AUTO_INCREMENT值的修改方式

    2023-10-15 07:12:19
  • Python NumPy实用函数笔记之allclose

    2023-08-24 18:09:12
  • asp之家 网络编程 m.aspxhome.com