Hello kl!



 kl_divergence:

I have two matrix X and Y. Both are of dimension [bs, hidden_size].
I want to take inverse of matrix obtained by torch.cat([X, Y], dim=1).


Could you explain conceptually what meaning this matrix inverse
is supposed to have?  Your construction seems odd.
As you have recognized, a matrix must be square to be invertible
(although not all square matrices are invertible, of course).  But
your batch size (bs) is something of a 'technical" parameter that
doesn’t really have anything to do with your data or the structure of
your network. As you point out, you have to adjust your batch size
to match hidden_size / 2.  But how does your construction make
sense if it breaks when you change your batch size?
Best.
K. Frank