Concatenate tensors with only one matching dimension

Is it possible to concatenate two tensors of size torch.Size([1, 1, 16, 16]) and torch.Size([1, 19, 1, 1])?
I tried torch.cat() but it’s giving the following error:
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 16 but got size 1 for tensor number 1 in the list.

It’s not possible unless you first buffer both tensors to match on the other dims not being concatenated.

Example:

# initial tensors
x = torch.rand((1,1,16,16))
y = torch.rand((1,19,1,1))

# buffered tensor shells
buffered_x = torch.empty((1,19,16,16))
buffered_y = torch.empty((1,19,16,16))

# assign buffered tensors
buffered_x[:,0:1,:,:] = x
buffered_y[:,:,0:1,0:1] = y

# concat
buffered_xy=torch.cat([buffered_x, buffered_y])

torch.Size([2, 19, 16, 16])