Hi,
I put my training data and labels under a list of zip objects “training_data” as shown in the following code:

training_data.append(zip(train_data_list,target_list))    # Build different batches for train data


When I tried to put the data into 2 separate lists, I ran with the following codes:

for batch, batch_dataLabel in enumerate(training_data):


    data = []
    label = []
        
    for D, true_label in batch_dataLabel:
        D = Variable(D.float())
        true_label = Variable(true_label.float())
        data.append(D)
        label.append(true_label)

    if gpu:
            data = data.cuda()
            label = label.cuda()

However, there was an Attribute Error, stating that ‘list’ object has no attribute ‘cuda’. So, I tried another way suggested on the forum for using nn.ModuleList():

for batch, batch_dataLabel in enumerate(training_data):


    data = nn.ModuleList()
    label = nn.ModuleList()
        
    for D, true_label in batch_dataLabel:
        D = Variable(D.float())
        true_label = Variable(true_label.float())
        data.append(D)
        label.append(true_label)

    if gpu:
            data = data.cuda()
            label = label.cuda()

However, there is a Type Error at this time, stating that TypeError: torch.FloatTensor is not a Module subclass.
Do you have any ideas on how to solve the problem? Is it the list of zip objects being too complicated, so that it would be better for me to use a less complicated data structure?
Thank you very much in advance!