def __call__(self, monotonic_step, src_lens):
        """
        monotonic_step range from 0 to src_len. src_len means eos
        delays: bsz, tgt_len
        src_lens: bsz, 1
        """
        if not self.start_from_zero:
            monotonic_step -= 1

        src_lens = src_lens

        delays = monotonic_step.view(
            monotonic_step.size(0), -1, monotonic_step.size(-1)
        ).max(dim=1)[0]

        delays = delays.masked_fill(delays >= src_lens, 0) + (src_lens - 1).expand_as(
            delays
        ).masked_fill(delays < src_lens, 0)
        return_dict = {}
        for key, func in self.metric_calculator.items():
            return_dict[key] = func(
                delays.float(),
                src_lens.float(),
                target_padding_mask=None,
                batch_first=True,
                start_from_zero=True,
            ).t()

        return return_dict

        monotonic_step range from 0 to src_len. src_len means eos
        delays: bsz, tgt_len
        src_lens: bsz, 1
        
decoding/IAD/fairseq/examples/simultaneous_translation/utils/latency.py