def get_cache_size(self):
        """determine how long the cache should be"""
        trim_len = self.get_trim_len()
        # give a buffer of 64 steps since a span might increase
        # in future updates
        return min(self._max_span, self._max_span - trim_len + 64)
determine how long the cache should be
understand_icl/fairseq/examples/adaptive_span/adaptive_span_attention.py