Ah , I think you pointed out the problem. I changed that line to:
        trans = torch.cat((x1,torch.zeros(x.size(0),self.latent_dim - self.trans_dim).to(device)), dim = 1)
        x0 = x0 + trans

which (hopefully) has the same effect but now the code runs with no error. Sorry, I’m still a bit inexperienced and didn’t know “+=” was an in-place operation. Thank you so much for your help!