I am trying to print the file name into a csv file but getting an error message file is not defined:
output = model(images)
preds = output.sum(dim=[1,2,3])
print(preds)
with open('predsLilas1.csv','a') as fd:
fd.write( ','.join(map(str, preds.detach().tolist())) + '\n')
fd.write( ','.join(map(str, targets.detach().tolist())) + '\n')
fd.write( ','.join(map(str, filename.detach().tolist())) + '\n')