#dim=0,上下拼接
#dim=1,左右拼接
import torch
# x1
x1 = torch.tensor([[1,2,3],[4,5,6]],dtype=torch.int)
# x2
x2 = torch.tensor([[7,8,9],[10,11,12]],dtype=torch.int)
#'inputs为2个形状为[2 , 3]的矩阵 '
inputs = [x1, x2]
print(inputs)
#dim=0,上下拼接
print(torch.cat(inputs, dim=0))
#dim=1,左右拼接
print(torch.cat(inputs, dim=1))