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]])
原文:https://www.cnblogs.com/retrospect/p/14700289.html