torch.Tensor.reshape¶
- Tensor.reshape(*shape) Tensor ¶
返回一个与
self
具有相同数据和元素数量,但形状为指定形状的 tensor。如果shape
与当前形状兼容,此方法将返回一个视图。请参阅torch.Tensor.view()
,了解何时可以返回视图。请参阅
torch.reshape()
- 参数
shape (ints 的 tuple 或 int...) – 期望的形状
返回一个与 self
具有相同数据和元素数量,但形状为指定形状的 tensor。如果 shape
与当前形状兼容,此方法将返回一个视图。请参阅 torch.Tensor.view()
,了解何时可以返回视图。
请参阅 torch.reshape()
shape (ints 的 tuple 或 int...) – 期望的形状