def METHOD_NAME(self, samples):
    if len(samples) == 0:
        return {}
    features = [s["features"] for s in samples]
    sizes = [len(s) for s in features]
    target_size = max(sizes)
    collated_features = features[0].new_zeros(
        len(features), target_size, features[0].size(-1)
    )
    padding_mask = torch.BoolTensor(collated_features.shape[:-1]).fill_(False)
    for i, (f, size) in enumerate(zip(features, sizes)):
        collated_features[i, :size] = f
        padding_mask[i, size:] = True
    res = {
        "id": torch.LongTensor([s["id"] for s in samples]),
        "net_input": {"features": collated_features, "padding_mask": padding_mask},
    }
    if len(self.labels) > 0:
        target = data_utils.collate_tokens(
            [s["target"] for s in samples],
            pad_idx=self.label_dict.pad(),
            left_pad=False,
        )
        res["target"] = target
    if self.aux_tgt:
        idxs = torch.nn.utils.rnn.pad_sequence(
            [s["aux_target"] for s in samples],
            batch_first=True,
            padding_value=-1,
        )
        res["net_input"]["aux_target"] = idxs
    return res