【发布时间】:2021-08-11 09:40:38
【问题描述】:
我想用 torch 函数得到这个结果。你有什么建议吗?
import torch
test_tensor=torch.tensor([[1, 2, 3, 4, 5, 6],
[7, 8, 9, 10, 11, 12]]
)
print(test_tensor)
'''
I would like to get:
t_1 = torch.tensor([[6], #1+2+3
[24]])#7+8+9
t_2 = torch.tensor([[9], #1+3+5
[27]])#7+9+11
'''
【问题讨论】:
标签: python python-3.x pytorch