返回具有相同數據但大小不同的新張量。
返回的張量共享相同的數據,必須具有相同數量的元素,但可能有不同的大小。
Example
>>> x = torch.randn(4, 4) >>> x.size() torch.Size([4, 4]) >>> y = x.view(16) >>> y.size() torch.Size([16]) >>> z = x.view(-1, 8) # the size -1 is inferred from other dimensions >>> z.size() torch.Size([2, 8])
