torch.cat()

import torch

x = torch.randint(2, 3)
x1 = torch.cat((x, x), 0)
x2 = torch.cat((x, x), 1)
print(x)
print(x1)
print(x2)

结果:
x:([[1, 4, 5],
   [4, 3, 1]])

x1: ([[1, 4, 5],
   [4, 3, 1],
   [1, 4, 5],
   [4, 3, 1]])

x2: ([[1, 4, 5, 1, 4, 5],
   [4, 3, 1, 4, 3, 1]])

posted @ 2021-04-25 14:59  id_ning  阅读(116)  评论(0编辑  收藏  举报