Closed celsofranssa closed 3 years ago
Hi,
entity_masks
is a ExC tensor (E := number of positive+negative entity mention samples, C := context size), used for accessing tokens belonging to an entity span (...and masking any other token).
entity_sizes
is a tensor of size E, containing the size of each entity mention span (which is later mapped to an embedding)
entity_types
is a tensor of size E, containing the id of the corresponding entity type (also mapped to an embedding)
rels
is a Rx2 tensor (R := number of positive+negative relation samples, i.e. pairs of related (or unrelated) entity mentions), which contains the indices of corresponding entity mentions in entity_masks
(and entity_size
+ entity_types
). Used to retrieve entity mention representations for each pair after max-pooling is applied via entity_masks
.
rel_masks
is a RxC tensor, used to access the tokens between two entity mention (and mask any other token).
rel_types
is a RxT tensor (T := number of relation types), which contains the multi-hot-encoding of relation types for each pair (all 0 -> strong negative sample)
entity_sample_masks
is a tensor of size E, used for masking 'padding' entity mention samples (since we need to introduce 'padding' mentions due to batching over sentences)
relation_sample_masks
is a tensor of size R, used for masking 'padding' relation samples (since we need to introduce 'padding' relations due to batching over sentences)
When iterating over dataset samples we have the fowling dictionary of tensors:
Could you provide the meaning of these tensors? For instance,
encodings
andcontext-mask
maps directly toinput_ids
andattention_mask
ofBERT
forward
method. Therefore what are the semantics of the others tensors?