Hi there,
I have a torch tensor whose size is [100000, 15, 2] and I want to use it as my dataset (because I am working with GANs so no label needed). and here is my code:
shuffle = True
batch_size = 125
num_worker = 2
pin_memory = True
tensor_input_data = torch.Tensor(input_data)
my_dataset = TensorDataset(tensor_input_data)
my_dataloader = DataLoader(dataset= my_dataset,
shuffle=shuffle,
batch_size=batch_size,
num_workers=num_worker,
pin_memory=pin_memory)
when I load the dataloader for training
for epoch in range(n_epochs):
for real in tqdm(dataloader):
cur_batch_size = len(real)
real = real.view(cur_batch_size, -1).to(device)
It has the traceback that says ‘list’ object has no attribute ‘view’, I know this mean that “real” is a list, but why?
Appreciate any suggestions!