def get_attention(config: AttentionConfig, max_seq_len: int, prefix: str = C.ATTENTION_PREFIX) -> 'Attention':
    """
    Returns an Attention instance based on attention_type.

    :param config: Attention configuration.
    :param max_seq_len: Maximum length of source sequences.
    :param prefix: Name prefix.
    :return: Instance of Attention.
    """

    att_cls = Attention.get_attention_cls(config.type)
    params = config.__dict__.copy()
    params.pop('_frozen')
    params['max_seq_len'] = max_seq_len
    params['prefix'] = prefix
    return _instantiate(att_cls, params)
def get_attention ( config : AttentionConfig , max_seq_len : int , prefix : str = C . ATTENTION_PREFIX ) -> 'Attention' : att_cls = Attention . get_attention_cls ( config . type ) params = config . __dict__ . copy ( ) params . pop ( '_frozen' ) params [ 'max_seq_len' ] = max_seq_len params [ 'prefix' ] = prefix return _instantiate ( att_cls , params )
Returns an Attention instance based on attention_type.

    :param config: Attention configuration.
    :param max_seq_len: Maximum length of source sequences.
    :param prefix: Name prefix.
    :return: Instance of Attention.