x = torch.Tensor(2,3)
y = x.permute(1,0)
y.view(-1) # 报错,因为x和y指针指向相同
y = x.permute(1,0).contiguous()
y.view(-1) # OK
PyTorch contiguous 的概念
最新推荐文章于 2023-08-23 21:49:09 发布
x = torch.Tensor(2,3)
y = x.permute(1,0)
y.view(-1) # 报错,因为x和y指针指向相同
y = x.permute(1,0).contiguous()
y.view(-1) # OK