Closed HongkuanZhang closed 2 years ago
Because it is no longer necessary to have the samples to be sorted by att_feat length.
Let key=lambda x: 0 basically make sorted work as a noop.
Let key=lambda x: 0 basically make sorted work as a noop.
Got it! I just wonder why not remove this line if it does nothing :)
I have a question about the code below, which is from the collate_func of the Dataset class.
I think it aims to sort the batch data by the att_feat length for later padding, but why use the lambda x:0 instead of lambda x: len(x[1]) as the key for sort?
https://github.com/ruotianluo/self-critical.pytorch/blob/be1a526b058707eb136ede9397b54d971374fb1f/captioning/data/dataloader.py#L228