# 创建一个 2x3x4 的张量 import torch x = torch.randn(2, 3, 4) # shape: [2, 3, 4] print(x) # 自动推断第一维 y = x.view(-1,1, 4) # shape: [6, 4] print(y) print("使用-1:", y.shape)