I have two tensors containing batches of matrices of the same batch size (first dimension) but different matrix structure (all other dimensions). For example A of shape (n,d,d) and B (n,e,e). Now I would like to build block diagonals of A and B for all n. So that the output shape (n,(d+e),(d+e)).
Is there an implementation for a problem like this?
I could only find torch.block_diag which is not suited for dimensions higher than 2.