We Are Going To Discuss About Pytorch: RuntimeError: result type Float can’t be cast to the desired output type Long. So lets Start this Python Article.
Pytorch: RuntimeError: result type Float can’t be cast to the desired output type Long
- How to solve Pytorch: RuntimeError: result type Float can't be cast to the desired output type Long
I was getting the same error doing this:
loss_fn(output, target)
where the output was Tensor torch.float32 and target was Tensor torch.int64. What solved this problem was calling the loss function like this:loss_fn(output, target.float())
- Pytorch: RuntimeError: result type Float can't be cast to the desired output type Long
I was getting the same error doing this:
loss_fn(output, target)
where the output was Tensor torch.float32 and target was Tensor torch.int64. What solved this problem was calling the loss function like this:loss_fn(output, target.float())
Solution 1
I was getting the same error doing this:
loss_fn(output, target)
where the output was Tensor torch.float32 and target was Tensor torch.int64. What solved this problem was calling the loss function like this:
loss_fn(output, target.float())
Original Author 5ar Of This Content
Conclusion
So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.