Skip to content
Advertisement

Tag: pytorch

reorder columns in a tensor according to a dictionary

I don’t know how to explain it correctly, so the title might be misleading. What I want to do is to move columns from a 3d tensor t1 to another 3d tensor t2 according to the indices. There’s a dictionary td, and a (k,v) pair in td means that kth column of t1 will be the vth column of t2

Difference between the calculation of the training loss and validation loss using pytorch

I wanna use the following code of this traditional image classification problem for my regression problem. The code can be found here: GeeksforGeeks-Training Neural Networks with Validation using Pytorch I can understand why the training loss is summed up and then divided by the length of the training data in this example, but I can’t get why the validation loss

pytorch cuda out of memory while inferencing

I think this is a very basic question, my apologies as I am very new to pytorch. I am trying to find if an image is manipulated or not using MantraNet. After running 2-3 inferences I get the CUDA out of memory, then after restarting the kernel also I keep getting the same error: The error is given below: RuntimeError:

What are the main reasons why some network parameters might become nan after calling optimizer.step in Pytorch?

I am trying to understand why one or two parameters in my Pytorch neural network occasionally become nan after calling optimizer.step(). I have already checked the gradients after calling .backward() and just before calling the optimizer, and they neither contain nans nor are very large. I am doing gradient clipping, but I don’t think that this can be responsible since

Creating and Use a PyTorch DataLoader

I am trying to create a PyTorch Dataset and DataLoader object using a sample data. This is the tab seperated dataset: This is the code to create the Dataset above and DataLoader object: The code is simply saved with the filename “demo.py”. The code should succesfully execute once the command ‘python demo.py’ is executed on a command prompt screen. I

Advertisement