Skip to content

Tag: pytorch

Pytorch crashes cuda on wrong line

How to see which python line causes a cuda crash down the line in Pytorch, which executes asynchronous code outside of the GIL? Here is a case where I had Pytorch crash cuda, running this code on this dataset and every run would crash with the debugger on a different python line, making it very difficult to d…

Scale down image represented in a tensor

I use the MNIST dataset to learn Pytorch. This is from the documentation to get a picture. Tensor comes from the torchvision dataset. This is the Tensor: I want to scale the image down to a 14×14 picture, so I guess I need a torch.Size([1, 14, 14]) I tried this, but it results in a different format: I ex…

Why is the code not able to approximate the square function?

WHy does the following code not work as a square approximator? I am getting weird dimensions. When I tried plotting loss, the graph somehow does not show anything. I am a beginner with pytorch, so I would be grateful for any help. Answer Your data is ranging from -10000 to 10000! You need to standardize your …