昇腾社区首页
中文
注册

通过torch生成数据

用户可以通过torch框架生成Tensor数据作为输入数据/标杆数据,然后调用tensor_xxx接口导入。

import torch
import ascendebug
# 生成输入/标杆数据
x = torch.rand(size=(1, 16384), dtype=torch.float16)
y = torch.rand(size=(1, 16384), dtype=torch.float16)
z = x + y
# 配置输入数据
debug_op = ascendebug.create_debug_op('add_custom').tensor_input('x', x) .tensor_input('y', y).tensor_output('z', z)