def METHOD_NAME(self, samples):
    def transform(item):
        if self.append_eos_to_src:
            self.eos = self.eos.to(device=item["source"].device)
            self._check_src(item["source"], expect_eos=False)
            item["source"] = torch.cat([item["source"], self.eos])
        if self.remove_eos_from_src:
            self.eos = self.eos.to(device=item["source"].device)
            self._check_src(item["source"], expect_eos=True)
            item["source"] = item["source"][:-1]
        if self.append_eos_to_tgt:
            self.eos = self.eos.to(device=item["target"].device)
            self._check_tgt(item["target"], expect_eos=False)
            item["target"] = torch.cat([item["target"], self.eos])
        if self.remove_eos_from_tgt:
            self.eos = self.eos.to(device=item["target"].device)
            self._check_tgt(item["target"], expect_eos=True)
            item["target"] = item["target"][:-1]
        return item
    samples = list(map(transform, samples))
    return self.dataset.METHOD_NAME(samples)