Speed up SVD in PyTorch
I am doing some classification task for CIFAR10 with Pytorch and for each iteration I have to do some preprocessing on each batch before I would be able to feed forward to the model. Below is the code for the preprocessing part on each batch: S = torch.zeros((batch_size, C, H, W)) for i in range(batch_size): img = batch[i, :, :, :] for c in range(C): U, _, V = torch.svd(img[c]) S[i, c] = U[:, 0].view(-1, 1).matmul(V[:, 0].view(1, -1)) However, this calculation is very slow. Is there any way that I could speed up this code?
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.