torch.unsqueeze函数使用示例

y =x = torch.tensor([1, 0])
x = torch.unsqueeze(x, dim=1)
print(x)
y = torch.unsqueeze(y, dim=0)
print(y)


# tensor([[1],
#         [0]])


# tensor([[1, 0]])

猜你喜欢

转载自blog.csdn.net/djdjdhch/article/details/130600281