Hi Capangas!



 Capangas:

einsum seems to fit perfectly with the problem


einsum() is a fine solution – and a good general-purpose tool.


If there is some way that is more specific then someone might feel free to comment.


In your specific case, you can use torch.bmm() with a couple of
well-placed unsqueeze()s.  A good discussion is found in this thread:

  
    
    
    Batch Outer Product 
  
  
    Title says it all. Is there a way to compute a batch outer product. I noticed that pytorch conveniently has torch.ger which takes in two one-dimensional vectors and outputs there outer-product: (1, n) * (1, m) -> (n, m) 
Is there a batch version of this operation? (b, n) * (b, m) -> (b, n, m)
  


Best.
K. Frank