Hi ,
Try the following solution.
import torch

a, b, c, d = 2, 3, 4, 4
A = torch.tensor([[10, 20, 30], [40, 50, 60]]) # a = 2, b = 3
B = torch.tensor([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]) # c = 4 , d = 4

A = A [:, None, :]
B = B [None, :, :]

A = A.repeat_interleave(c, 1)
B = B.repeat_interleave(a, 0)

C = torch.cat((A, B), dim=2)

print(C.size())

Thanks