评价此页

torch.Tensor.reshape#

Tensor.reshape(*shape) Tensor#

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

请参阅torch.reshape()

参数

shape (int元组int...) – 所需的形状