If you replace y =torch.cat([xx,xx,xx],0) with y =torch.stack([xx,xx,xx],2) it works 
import torch
xx = torch.rand(28,28)
y =torch.stack([xx,xx,xx],0)
print(xx.shape)
print(y.shape)
print(torch.norm(y[:,:,0] - xx))