Cast a Tensor to another Type in PyTorch

We can cast a Tensor to another type in PyTorch as below: import torch # Create a float tensor y = torch.randn(5, 5) # Cast the flost tensor to int tensor in pytorch y = y.int() Cast a Tensor to another Type in PyTorch Neural Network Machine Learning Algorithm From Scratch in Python is a … Continue reading Cast a Tensor to another Type in PyTorch