a = torch.rand(2, 3)
b = torch.rand(4, 3)
c = b.expand_as(a)
print(c)

a = torch.rand(2, 3)
b = torch.rand(2, 4)
c = b.expand_as(a)
print(c)

I dont know why it does not work. What is the right way to figure it out?