model.eval()
with torch.no_grad():
#step = 99999
#for i in range(0, len(test), step):
# test_data = test.tolist()[i: i+step]
for i, (images, targets, ImageIDs) in enumerate(train_loader):
images = list(image.to(device) for image in images)
targets = [{k: v.to(device) for k, v in t.items()} for t in targets]
outputs = model(images)
preds = torch.max(outputs, dim=1)
id_list.append(images)
pred_list.append(pred.item())
submissions = pd.DataFrame({'ImageID': id_list, 'predictions': pread_list})
submissions.to_csv('test_data/sample_submission.csv', index=False, header=True)
TypeError Traceback (most recent call last)
Input In [11], in <cell line: 2>()
10 targets = [{k: v.to(device) for k, v in t.items()} for t in targets]
12 outputs = model(images)
—> 13 preds = torch.max(outputs, dim=600)
15 id_list.append(images)
16 pred_list.append(pred.item())
TypeError: max() received an invalid combination of arguments - got (list, dim=int), but expected one of:
- (Tensor input)
- (Tensor input, Tensor other, *, Tensor out)
- (Tensor input, int dim, bool keepdim, *, tuple of Tensors out)
- (Tensor input, name dim, bool keepdim, *, tuple of Tensors out)