Scatter Softmax¶
-
torch_scatter.composite.
scatter_softmax
(src, index, dim=-1, eps=1e-12)[source]¶ Softmax operation over all values in
src
tensor that share indices specified in theindex
tensor along a given axisdim
.For one-dimensional tensors, the operation computes
\[\mathrm{out}_i = {\textrm{softmax}(\mathrm{src})}_i = \frac{\exp(\mathrm{src}_i)}{\sum_j \exp(\mathrm{src}_j)}\]where \(\sum_j\) is over \(j\) such that \(\mathrm{index}_j = i\).
Parameters: Return type: Tensor
-
torch_scatter.composite.
scatter_log_softmax
(src, index, dim=-1, eps=1e-12)[source]¶ Log-softmax operation over all values in
src
tensor that share indices specified in theindex
tensor along a given axisdim
.For one-dimensional tensors, the operation computes
\[\mathrm{out}_i = {\textrm{log_softmax}(\mathrm{src})}_i = \log \left( \frac{\exp(\mathrm{src}_i)}{\sum_j \exp(\mathrm{src}_j)} \right)\]where \(\sum_j\) is over \(j\) such that \(\mathrm{index}_j = i\).
Parameters: Return type: Tensor