torch.Tensor — PyTorch 1.10.1 documentation
pytorch.org › docs › stableTensor.type. Returns the type if dtype is not provided, else casts this object to the specified type. Tensor.type_as. Returns this tensor cast to the type of the given tensor. Tensor.unbind. See torch.unbind() Tensor.unfold. Returns a view of the original tensor which contains all slices of size size from self tensor in the dimension dimension ...
torch.as_tensor — PyTorch 1.10.1 documentation
pytorch.org › generated › torchtorch.as_tensor¶ torch. as_tensor (data, dtype = None, device = None) → Tensor ¶ Convert the data into a torch.Tensor.If the data is already a Tensor with the same dtype and device, no copy will be performed, otherwise a new Tensor will be returned with computational graph retained if data Tensor has requires_grad=True.