yes this is a better question for elsewhere but in short you have to use e.g. indexing, masking, cating etc
x = torch.ones(1, requires_grad=True)
y = torch.ones(1, requires_grad=True)
xy1 = torch.cat([x, y])
xy2 = torch.zeros(2)
xy2[0] = x
xy2[1] = y
# etc etc etc