device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
for batch_idx, batch in enumerate(train_dataloader, 0): #枚举类型
x_p,x_c,y=map(lambda x: x.to(device), batch)
print("*********")
print("punchline shape: ",x_p.shape)
print("context shape: ",x_c.shape)
print("humor labels: ",y)
if batch_idx==5:
break
第二行代码报错
IndexError: only integers, slices (:
), ellipsis (...
), numpy.newaxis (None
) and integer or boolean arrays are valid indices