if not isinstance(batch[key], list):
batch[key] = Variable(batch[key].cuda(), volatile=True)
enc_out = encoder(batch["img_feat"], batch["ques_fwd"], batch["hist"])
dec_out = decoder(enc_out, batch["opt"])
// sort in descending order - largest score gets highest rank
sorted_ranks, ranked_idx = dec_out.data.sort(1, descending=True)
After Change
help="Whether to use ground truth for retrieving ranks")
parser.add_argument("-batch_size", default=12, type=int, help="Batch size")
parser.add_argument("-gpuid", default=0, type=int, help="GPU id to use")
parser.add_argument("-overfit", action="store_true",
help="Use a batch of only 5 examples, useful got debugging")
parser.add_argument_group("Submission related arguments")
parser.add_argument("-save_ranks", action="store_true",
help="Whether to save retrieved ranks")
parser.add_argument("-save_path", default="logs/ranks.json",