On this page
torch.Tensor.type_as
Tensor.type_as(tensor) → Tensor
-
Returns this tensor cast to the type of the given tensor.
This is a no-op if the tensor is already of the correct type. This is equivalent to
self.type(tensor.type())
- Parameters
-
tensor (Tensor) – the tensor which has the desired type
© 2024, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://pytorch.org/docs/2.1/generated/torch.Tensor.type_as.html