**Background:**

Thanks for your attention! I am learning the basic knowledge of 2D convolution, linear algebra and PyTorch. I encounter the implementation problem about the psedo-inverse of the convolution operator. Specifically, I have no idea about how to implement it in an efficient way. Please see the following problem statements for details. Any help/tip/suggestion is welcomed.

(Thanks a lot for your attention!)

**The Original Problem:**

I have an image feature `x`

with shape `[b,c,h,w]`

and a `3x3`

convolutional kernel `K`

with shape `[c,c,3,3]`

. There is `y = K * x`

. How to implement the corresponding pseudo-inverse on `y`

in an efficient way?

There is [y = K * x = Ax], how to implement [x_hat = (A^+)y]?

I guess that there should be some operations using `torch.fft`

. However, I still have no idea about how to implement it. I do not know if there exists an implementation previously.

```
import torch
import torch.nn.functional as F
c = 32
K = torch.randn(c, c, 3, 3)
x = torch.randn(1, c, 128, 128)
y = F.conv2d(x, K, padding=1)
print(y.shape)
# How to implement pseudo-inverse for y = K * x in an efficient way?
```

**Some of My Efforts:**

I may know that the 2D convolution is a linear operator. It is equivalent to a â€śmatrix productâ€ť operator. We can actually write out the matrix form of the convolution and calculate its psedo-inverse. However, I think this type of operation will be inefficient. And I have no idea about how to implement it in an efficient way.

According to Wikipedia, the psedo-inverse may satisfy the property of `A(A_pinv(x))=x`

, where `A`

is the convolutional operator, `A_pinv`

is its psedo-inverse, and `x`

may be any image feature.

(Thanks again for reading such a long post!)