Category "pytorch"

What is the time-complexity of the pseudo-inverse in pytorch (i.e. torch.pinverse)?

Let's say I have a matrix X with n, m == X.shape in PyTorch. What is the time complexity of calculating the pseudo-inverse with torch.pinverse? In other words,

Why do we need to call zero_grad() in PyTorch?

Why does zero_grad() need to be called during training? | zero_grad(self) | Sets gradients of all model parameters to zero.

Why do we need to call zero_grad() in PyTorch?

Why does zero_grad() need to be called during training? | zero_grad(self) | Sets gradients of all model parameters to zero.

libtorch and pytorch cannot be installed simultaneously?

I am learning to develop with PyTorch as well as LibTorch. I have the following line in my ~/.bashrc for dynamic linking of libtorch libraries: # libtorch linki

How does calculation in a GRU layer take place

So I want to understand exactly how the outputs and hidden state of a GRU cell are calculated. I obtained the pre-trained model from here and the GRU layer has

how do i solve Key 8 error while using pytorch?

from torch.utils.data import (TensorDataset, DataLoader, RandomSampler, SequentialSampler) def data_loader(train_inputs, val_inp

Pytorch unable to export trained model as ONNX

I have been training a model in the Pytorch framework using multiple convolutional layers (3x3, stride 1, padding same). The model performs well and I want to u

How to fix 'The kernel appears to have died. It will restart automatically" caused by pytorch

I have a strange problem with Pytorch. When i use something torch functions with tensors like tensor.rehsape or torch.transpose, i don't have problem and all o

Some parameters are not getting saved when saving a model in pytorch

I have built an encoder-decoder model with attention for morph inflection generation. I am able to train the model and predict on test data but I am getting wro

Torch sum a tensor along an axis

How do I sum over the columns of a tensor? torch.Size([10, 100]) ---> torch.Size([10])

Pytorch with CUDA local installation fails

I am trying to install PyTorch with CUDA. I followed the instructions (installation using conda) mentioned in https://pytorch.org/get-started/locally/ conda in

How to upscale image in pytorch?

how to upscale an image in Pytorch without defining height and width using transforms? ('--upscale_factor', type=int, required=True, help="super resolution ups

numpy equivalent code of unsqueeze and expand from torch tensor method

I have these 2 tensors box_a = torch.randn(1,4) box_b = torch.randn(1,4) and i have a code in pytorch box_a[:, 2:].unsqueeze(1).expand(1, 1, 2) but i want to

How to get not normalized MNIST dataset PyTorch C++

I'm trying to follow this C++ PyTorch example but I need to load the MNIST dataset with its standard values, between 0 and 255. I removed the application of the

How to remove the last FC layer from a ResNet model in PyTorch?

I am using a ResNet152 model from PyTorch. I'd like to strip off the last FC layer from the model. Here's my code: from torchvision import datasets, transforms

Multiprocessing, file not found

I'm using AlphaPose from GitHub and I'd like to run the script script/demo_inference.py from another script I created in AlphaPose root called run.py. In run.py

ModuleNotFoundError: No module named 'numpy.core._multiarray_umath' on matplotlib import

I'm trying to run a simple testfile on a remote Server. But it throws a numpy error for matplotlib.pyplot. Here is the code import matplotlib.pyplot as plt impo

LibTorch with OpenCV: version GOMP_5.0 not found

I'm trying to use OpenCV and LibTorch in the same project. Libtorch is installed in /usr/include/libtorch, downloaded from the PyTorch website. I'm using the cx

Is there any way I can use the downloaded pre-trained models for TIMM?

For some reason, I have to use TIMM package offline. But I found that if I use create_model(), for example: self.img_encoder = timm.create_model("swin_base_patc

can anyone explain what "out = self(images)" do in below code

I am not able to understand, if prediction is calculated in forward method, then why there is need "out = self(images)" and what it will do. I am bit confuse ab