下载
中文
注册
我要评分
文档获取效率
文档正确性
内容完整性
文档易理解
在线提单
论坛求助
昇腾小AI

TorchAir python层日志

功能简介

TorchAir python层日志开启主要通过python中logger.setLevel( )函数实现,方便进行python层功能调试和问题定位。

支持的日志级别如下:

  • logging.DEBUG:日志级别DEBUG。
  • logging.INFO:日志级别INFO。
  • logging.WARNING:日志级别WARNING。
  • logging.ERROR:日志级别ERROR。

logger.setLevel的缺省值为“logging.ERROR”,更详细的介绍请参见python官网logging模块

使用方法

1
2
3
4
import logging
import torch_npu
from torchair import logger
logger.setLevel(logging.DEBUG)

python侧debug日志样例如下:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[DEBUG] TORCHAIR 2024-04-03 09:37:40 -------------------
[DEBUG] TORCHAIR 2024-04-03 09:37:40 target: arg1_1
[DEBUG] TORCHAIR 2024-04-03 09:37:40 output Pack(meta:FakeTensor(dtype=torch.float32, size=[s0, 1] npu:Tensor(arg1_1:0, dtype=DT_FLOAT, size=[s0, 1])))
[DEBUG] TORCHAIR 2024-04-03 09:37:40 -------------------
[DEBUG] TORCHAIR 2024-04-03 09:37:40 target: arg2_1
[DEBUG] TORCHAIR 2024-04-03 09:37:40 output Pack(meta:FakeTensor(dtype=torch.float32, size=[s0, s0] npu:Tensor(arg2_1:0, dtype=DT_FLOAT, size=[s0, s0])))
[DEBUG] TORCHAIR 2024-04-03 09:37:40 -------------------
[DEBUG] TORCHAIR 2024-04-03 09:37:40 target: arg3_1
[DEBUG] TORCHAIR 2024-04-03 09:37:40 output Pack(meta:FakeTensor(dtype=torch.int32, size=[s0, s0] npu:Tensor(arg3_1:0, dtype=DT_INT32, size=[s0, s0])))
[DEBUG] TORCHAIR 2024-04-03 09:37:40 -------------------
[DEBUG] TORCHAIR 2024-04-03 09:37:40 target: aten.mul.Tensor
[DEBUG] TORCHAIR 2024-04-03 09:37:40 input 0: Pack(meta:FakeTensor(dtype=torch.float32, size=[s0, s0] npu:Tensor(arg2_1:0, dtype=DT_FLOAT, size=[s0, s0])))
[DEBUG] TORCHAIR 2024-04-03 09:37:40 input 1: Pack(meta:FakeTensor(dtype=torch.int32, size=[s0, s0] npu:Tensor(arg3_1:0, dtype=DT_INT32, size=[s0, s0])))
[DEBUG] TORCHAIR 2024-04-03 09:37:40 output Pack(meta:FakeTensor(dtype=torch.float32, size=[s0, s0] npu:Tensor(Cast_1:0, dtype=DT_FLOAT, size=[s0, s0])))
[DEBUG] TORCHAIR 2024-04-03 09:37:40 -------------------
[DEBUG] TORCHAIR 2024-04-03 09:37:40 target: aten.add.Tensor
[DEBUG] TORCHAIR 2024-04-03 09:37:40 input 0: Pack(meta:FakeTensor(dtype=torch.float32, size=[s0, 1] npu:Tensor(arg1_1:0, dtype=DT_FLOAT, size=[s0, 1])))
[DEBUG] TORCHAIR 2024-04-03 09:37:40 input 1: Pack(meta:FakeTensor(dtype=torch.float32, size=[s0, s0] npu:Tensor(Cast_1:0, dtype=DT_FLOAT, size=[s0, s0])))
[DEBUG] TORCHAIR 2024-04-03 09:37:40 output Pack(meta:FakeTensor(dtype=torch.float32, size=[s0, s0] npu:Tensor(Add:0, dtype=DT_FLOAT, size=[s0, s0])))
[DEBUG] TORCHAIR 2024-04-03 09:37:40 -------------------
[DEBUG] TORCHAIR 2024-04-03 09:37:40 target: output
[DEBUG] TORCHAIR 2024-04-03 09:37:40 input 0: Pack(meta:FakeTensor(dtype=torch.float32, size=[s0, s0] npu:Tensor(Add:0, dtype=DT_FLOAT, size=[s0, s0])))
[DEBUG] TORCHAIR 2024-04-03 09:37:40 output Pack(meta:FakeTensor(dtype=torch.float32, size=[s0, s0] npu:Tensor(Add:0, dtype=DT_FLOAT, size=[s0, s0])))
[DEBUG] TORCHAIR 2024-04-03 09:37:41 runtime inputs
[DEBUG] TORCHAIR 2024-04-03 09:37:41   input 0: <class 'int'>(4)
搜索结果
找到“0”个结果

当前产品无相关内容

未找到相关内容,请尝试其他搜索词