评价此页

torch.Tensor.reshape#

Tensor.reshape(*shape) Tensor#

返回一个张量,它具有与 self 相同的数据和元素数量,但具有指定的形状。如果 shape 与当前形状兼容,则此方法返回一个视图。请参阅 torch.Tensor.view() 关于何时可以返回视图。

请参阅 torch.reshape()

参数

shape (元组 of intint...) – 期望的形状