Really weird - I can’t see why. It works for me, and your error message points to the same issue. Lets see if someone else can chip in.
Can you try specifying the dimension to concatenate? Like
a = torch.randn(1, 48, 128)
b = torch.randn(1, 48, 128)
hidden = torch.cat((a,b), dim=0)

This will decide which dimension to concat over. Default is dim=0, but I just wanted to check,