Rate this Page

Function torch::stable::view#

Function Documentation#

inline torch::stable::Tensor torch::stable::view(const torch::stable::Tensor &self, torch::headeronly::IntHeaderOnlyArrayRef size)#

Stable version of the view op.

Returns a new tensor with the same data as the input tensor but with a different shape. The returned tensor shares the same data and must have the same number of elements.

Minimum compatible version: PyTorch 2.10.

Parameters:
  • self – The input tensor.

  • size – The desired output shape.

Returns:

A view tensor with the specified shape.