Computes softmax over a many-to-one relationship in a GraphTensor.
tfgnn.softmax(
graph_tensor: tfgnn.GraphTensor
,
per_tag: tfgnn.IncidentNodeOrContextTag
,
*,
edge_set_name: Union[Sequence[EdgeSetName], EdgeSetName, None] = None,
node_set_name: Union[Sequence[NodeSetName], NodeSetName, None] = None,
feature_value: Union[Sequence[Field], Field, None] = None,
feature_name: Optional[FieldName] = None
) -> Union[Sequence[Field], Field]
This function can be used to compute a softmax normalization...
- of edge values, across the edges with a common incident node at
per_tag
(e.g., SOURCE or TARGET); - of node values, across all the nodes in the same graph component;
- of edge values, across all the edges in the same graph component.
For non-scalar values, the softmax function is applied element-wise.
graph_tensor
|
A scalar GraphTensor. |
per_tag
|
tfgnn.CONTEXT for normalization per graph component, or an incident
node tag (e.g., tfgnn.SOURCE or tfgnn.TARGET ) for normalization per
common incident node.
|
edge_set_name
|
The name of the edge set on which values are normalized,
or a non-empty sequence of such names. Unless from_tag=tfgnn.CONTEXT ,
all named edge sets must have the same incident node set at the given tag.
|
node_set_name
|
The name of the node set on which values are normalized,
or a non-empty sequence of such names. Can only be passed together with
from_tag=tfgnn.CONTEXT . Exactly one of edge_set_name or node_set_name
must be set.
|
feature_value
|
A tensor or list of tensors, parallel to the node_set_names
or edge_set_names, to supply the input values of softmax. Each tensor
has shape [num_items, *feature_shape] , where num_items is the number
of edges in the given edge set or nodes in the given node set, and
*feature_shape is the same across all inputs.
|
feature_name
|
The name of a feature stored on each graph piece from which pooling is done, for use instead of an explicity passed feature_value. Exactly one of feature_name or feature_value must be set. |
A tensor or a list of tensors with the softmaxed values. The dimensions of the tensors and the length of the list do not change from the input. |