Hi. I’m implementing a varational autoencoder and I used the following code for the training part:

model.train()

train_loss = 0

for epoch in range(1, NUM_EPOCHS + 1):

for batch_idx, data in enumerate(train_loader):

#data = np.asarray(data)

#data = torch.from_numpy(data.astype(‘long’))

#data = data.detach().numpy()

#data = data.numpy()

#data = torch.FloatTensor(data)

data = data.to(device)

optimizer.zero_grad()

recon_batch, mu, logvar = model(data)

I get the error: ‘list’ object has no attribute ‘to’. How can I fix it? Thank you for your help.