MCPcopy Create free account
hub / github.com/ACL2020SpellGCN/SpellGCN / attention_layer

Function attention_layer

modeling.py:557–750  ·  view source on GitHub ↗

Performs multi-headed attention from `from_tensor` to `to_tensor`. This is an implementation of multi-headed attention based on "Attention is all you Need". If `from_tensor` and `to_tensor` are the same, then this is self-attention. Each timestep in `from_tensor` attends to the correspondin

(from_tensor,
                    to_tensor,
                    attention_mask=None,
                    num_attention_heads=1,
                    size_per_head=512,
                    query_act=None,
                    key_act=None,
                    value_act=None,
                    attention_probs_dropout_prob=0.0,
                    initializer_range=0.02,
                    do_return_2d_tensor=False,
                    batch_size=None,
                    from_seq_length=None,
                    to_seq_length=None)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 1

transformer_modelFunction · 0.85

Calls 5

get_shape_listFunction · 0.85
reshape_to_matrixFunction · 0.85
create_initializerFunction · 0.85
transpose_for_scoresFunction · 0.85
dropoutFunction · 0.85

Tested by

no test coverage detected