So I am trying to solve for the matrix A in b = Ax. I have a batch of vectors for b and x and I want to get a batch of A matices. I have tried two ways. One uses torch.gels and the other uses pinverse. Neither handles vectors properly with a batch.

This works with single vectors

**embed_0 = torch.tensor([[.4,.7,.8]])
embed_9 = torch.tensor([[3,.2,.1]])
M, _ = torch.gels(embed_9, embed_0)**

tensor([[0.9302, 0.0620, 0.0310],

[1.6279, 0.1085, 0.0543],

[1.8605, 0.1240, 0.0620]])

However, if I have batches of vectors it still outputs a single matrix for M

**embed_0 = torch.tensor([[.5, .9 ,1.0],[.4,.7,.8]])
embed_9 = torch.tensor([[.55, .77, .2],[3,.2,.1]])
M, _ = torch.gels(embed_9, embed_0)**

tensor([[ 46.2997, -7.1800, -1.0000],

[-127.9999, 20.8000, 3.0000],

[ 92.6000, -14.3600, -2.0000]])

How can I solve for the A matrix with batches?