Bases: Aggregation
The Set2Set aggregation operator based on iterative content-based attention, as described in the “Order Matters: Sequence to sequence for Sets” paper.
\[ \begin{align}\begin{aligned}\mathbf{q}_t &= \mathrm{LSTM}(\mathbf{q}^{*}_{t-1})\\\alpha_{i,t} &= \mathrm{softmax}(\mathbf{x}_i \cdot \mathbf{q}_t)\\\mathbf{r}_t &= \sum_{i=1}^N \alpha_{i,t} \mathbf{x}_i\\\mathbf{q}^{*}_t &= \mathbf{q}_t \, \Vert \, \mathbf{r}_t,\end{aligned}\end{align} \]
where \(\mathbf{q}^{*}_T\) defines the output of the layer with twice the dimensionality as the input.
in_channels (int) – Size of each input sample.
processing_steps (int) – Number of iterations \(T\).
**kwargs (optional) – Additional arguments of torch.nn.LSTM
.
Resets all learnable parameters of the module.
Forward pass.
x (torch.Tensor) – The source tensor.
index (torch.Tensor, optional) – The indices of elements for applying the aggregation. One of index
or ptr
must be defined. (default: None
)
ptr (torch.Tensor, optional) – If given, computes the aggregation based on sorted inputs in CSR representation. One of index
or ptr
must be defined. (default: None
)
dim_size (int, optional) – The size of the output tensor at dimension dim
after aggregation. (default: None
)
dim (int, optional) – The dimension in which to aggregate. (default: -2
)
max_num_elements – (int, optional): The maximum number of elements within a single aggregation group. (default: None
)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4