def _build_attention(self, memory, memory_sequence_length, mode, hparams):
    """Builds attention mechanism for attending over the hiddens."""
    del mode  # Unused.

    return attention_mechanisms.get(
        attention_type=hparams.attention_mechanism,
        num_units=hparams.attention_layer_size,
        memory=memory,
        memory_sequence_length=memory_sequence_length,
        scope="attention_over_hiddens")
Builds attention mechanism for attending over the hiddens.
language/labs/consistent_zero_shot_nmt/modules/decoders.py