On this page
torch.Tensor.reshape_as
Tensor.reshape_as(other) → Tensor-
Returns this tensor as the same shape as
other.self.reshape_as(other)is equivalent toself.reshape(other.sizes()). This method returns a view ifother.sizes()is compatible with the current shape. Seetorch.Tensor.view()on when it is possible to return a view.Please see
reshape()for more information aboutreshape.- Parameters
-
other (
torch.Tensor) – The result tensor has the same shape asother.
© 2024, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://pytorch.org/docs/2.1/generated/torch.Tensor.reshape_as.html