Rate this Page

Function torch::stable::reshape#

Function Documentation#

inline torch::stable::Tensor torch::stable::reshape(const torch::stable::Tensor &self, torch::headeronly::IntHeaderOnlyArrayRef shape)#

Stable version of the reshape op.

Returns a tensor with the same data and number of elements as the input, but with the specified shape. When possible, the returned tensor will be a view of the input.

Minimum compatible version: PyTorch 2.10.

Parameters:
  • self – The input tensor.

  • shape – The desired output shape.

Returns:

A tensor with the specified shape.