BoxTransformerModule
Box Transformer architecture combining a multiple BoxTransformerLayer modules. It is mainly used in BoxTransformer.
Parameters
PARAMETER | DESCRIPTION |
---|---|
input_size |
Input embedding size
TYPE:
|
num_heads |
Number of attention heads in the attention layers
TYPE:
|
n_relative_positions |
Maximum range of embeddable relative positions between boxes (further distances are capped to ±n_relative_positions // 2)
TYPE:
|
dropout_p |
Dropout probability both for the attention layers and embedding projections
TYPE:
|
head_size |
Head sizes of the attention layers
TYPE:
|
activation |
Activation function used in the linear->activation->linear transformations
TYPE:
|
init_resweight |
Initial weight of the residual gates. At 0, the layer acts (initially) as an identity function, and at 1 as a standard Transformer layer. Initializing with a value close to 0 can help the training converge.
TYPE:
|
attention_mode |
Mode of relative position infused attention layer. See the relative attention documentation for more information.
TYPE:
|
n_layers |
Number of layers in the Transformer
TYPE:
|
forward
Forward pass of the BoxTransformer
PARAMETER | DESCRIPTION |
---|---|
embeds |
Embeddings to contextualize
Shape:
TYPE:
|
boxes |
Layout features of the input elements
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Tuple[FloatTensor, List[FloatTensor]]
|
|