Hi,
It depends what axis you want to use for concatenation. Literally, you cannot do this as the tensors do not have the same size.



 deneme:

RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 2048 and 512 in dimension 2


You have to have same shape for all dims except the one you one to use as the concatenation dimension. You can achieve it using padding by repetition, zeros, etc. For repetition you can use torch.expand(size) but for other methods such as interpolation, you need to use torch.nn.functional.interpolation.
Personally, first I would make the dim=2 and dim=3 (last two dims) same size using F.interpolate then expand smaller tensors x and y by repetition using torch.expand.
Expand: Concat two tensors with different dimensions 140
Interpolation: Resize tensor without converting to PIL image? 13
Edit1: replace wrongly used pad instead of interpolate
Bests