摘要: import torch x = torch.randint(1,24, (2,3,4)) print(x) x = x.permute(2, 0, 1) print(x) 结果: 前: ([[[15, 23, 21, 14], [ 2, 15, 7, 14], [21, 8, 8, 22]], [ 阅读全文
posted @ 2021-04-26 10:15 id_ning 阅读(900) 评论(0) 推荐(0)
摘要: import torch a = torch.arange(2 * 3).view(2, 3) a_sum = torch.sum(a, 0) b = torch.arange(2 * 3 * 4).view(2, 3, 4) b_sum = torch.sum(b, (2, 1)) # 相当于b_ 阅读全文
posted @ 2021-04-26 09:46 id_ning 阅读(232) 评论(0) 推荐(0)