Concatenate feature maps with different dimension

Hi. I was trying to merge feature maps that I got from two different encoders which have different dimensions.

simclr_features: torch.Size([543, 512]) imagenet_features: torch.Size([543, 1024])

so I wanted: torch.Size([543, 1536]). what is a possible solution to do that?


x = torch.randn(3, 5)
y = torch.randn(3, 6)
z =, y), dim=1)

out -

torch.Size([3, 11])
1 Like