Open
Conversation
voltjia
approved these changes
Apr 9, 2026
Collaborator
Author
|
还需要在Infinilm中使用,进行更充分的验证后,再合并 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
目标版本
main
功能描述
打印的核心逻辑参考了 https://github.com/xtensor-stack/xtensor, 核心代码在io.cc文件中
c++和python中的tensor添加打印函数,可以全局或临时配置一下参数:
(1) 触发省略的阈值:数据量过多时,显示部分数据;
(2) 每行显示字符数量:显示宽度合适,自动换行;
(3) 精度:设置显示的小数点位数;
(4) edgeitems: 省略显示时,设置显示的数据数量
c++的cout函数支持的类型: BOOL,I8,I16,I32,I64,U8,U16,U32,U64,BF16,F16,F32,F64
python的print函数支持的类型: BOOL,I8,I16,I32,I64,U8,BF16,F16,F32,F64
已测试平台:
nvidia moore metax iluvatar hygon
python代码std::cout测试:
临时修改后,自动恢复原始配置
全局修改后,配置生效

print不同的数据类型

c++代码print测试:

临时修改后,自动恢复原始配置
全局修改后,配置生效

cout不同的数据类型

在infinilm中使用:
