Scatter LogSumExp¶
-
torch_scatter.scatter_logsumexp(src, index, dim=-1, out=None, dim_size=None, fill_value=None, eps=1e-12)[source]¶ Fills
outwith the log of summed exponentials of all values from thesrctensor at the indices specified in theindextensor along a given axisdim. If multiple indices reference the same location, their exponential contributions add (cf.scatter_add()).For one-dimensional tensors, the operation computes
\[\mathrm{out}_i = \log \, \left( \exp(\mathrm{out}_i) + \sum_j \exp(\mathrm{src}_j) \right)\]where \(\sum_j\) is over \(j\) such that \(\mathrm{index}_j = i\).
Parameters: - src (Tensor) – The source tensor.
- index (LongTensor) – The indices of elements to scatter.
- dim (int, optional) – The axis along which to index.
(default:
-1) - out (Tensor, optional) – The destination tensor. (default:
None) - dim_size (int, optional) – If
outis not given, automatically create output with sizedim_sizeat dimensiondim. Ifdim_sizeis not given, a minimal sized output tensor is returned. (default:None) - fill_value (int, optional) – If
outis not given, automatically fill output tensor withfill_value. (default:None) - eps (float, optional) – Small value to ensure numerical stability.
(default:
1e-12)
Return type: Tensor