grouped_vector_attention
Grouped vector attention over a neighborhood graph.
Classes:
-
GroupedVectorAttentionβVector attention over a neighborhood graph, with one weight vector shared by each group of channels.
GroupedVectorAttention [source] ΒΆ
GroupedVectorAttention(
channels: int,
num_groups: int,
attn_drop: float = 0.0,
qkv_bias: bool = True,
pe_multiplier: bool = False,
pe_bias: bool = True,
norm: Union[str, Callable, None] = "batch_norm",
act: Union[str, Callable, None] = "relu",
act_kwargs: Optional[Dict[str, Any]] = None,
norm_kwargs: Optional[Dict[str, Any]] = None,
**kwargs: Unpack[MessagePassingParams],
)
Bases: MessagePassing
Vector attention over a neighborhood graph, with one weight vector shared by each group of channels.
The relation between a query and its neighbor keys is optionally scaled and shifted by a learned encoding of their relative position, then mapped to num_groups weights and softmax-normalized over each destination's neighbors.
edge_index lists [source, target] pairs: keys and values come from the source points and queries from the target points, so a bipartite graph is given as (x_source, x_target) and (pos_source, pos_target) pairs.
Parameters:
-
channels(int) βFeature width of the queries, keys and values.
-
num_groups(int) βNumber of channel groups sharing one attention weight.
-
attn_drop(float, default:0.0) βDropout probability on the attention weights.
-
qkv_bias(bool, default:True) βWhether the query, key and value projections carry a bias.
-
pe_multiplier(bool, default:False) βWhether to scale the query-key relation by an encoding of the relative position.
-
pe_bias(bool, default:True) βWhether to shift the query-key relation and the values by an encoding of the relative position.
-
norm(Union[str, Callable, None], default:'batch_norm') βNormalization type or callable.
-
act(Union[str, Callable, None], default:'relu') βActivation type or callable.
-
act_kwargs(Optional[Dict[str, Any]], default:None) βExtra activation arguments.
-
norm_kwargs(Optional[Dict[str, Any]], default:None) βExtra normalization arguments.
-
**kwargs(Unpack[MessagePassingParams], default:{}) βExtra arguments for
MessagePassing.