quaterion.eval.accumulators.accumulator module
- class Accumulator[source]
Bases:
object
Accumulate calculated embeddings and corresponding targets for metrics and evaluators
- reset()[source]
Reset accumulated state
Use to reset accumulator state.
- set_filled()[source]
Prevent further accumulation
- update(**kwargs) None [source]
Accumulate batch
- Parameters:
for (**kwargs - embeddings and objects required for label calculation. E.g.) –
labels (pair-based tasks it is) –
pairs –
is (subgroups and for group-based tasks it) –
groups. –
- property embeddings
Concatenate list of embeddings to Tensor
Help to avoid concatenating embeddings for each batch during accumulation. Instead, concatenate it only on call.
- Returns:
torch.Tensor – batch of embeddings
- property filled: bool
State of accumulator
- Returns:
- bool - represents whether accumulator can still accumulate values or it is already
filled
- property state: Dict[str, Tensor]
Accumulated state
- Returns:
- Dict[str, torch.Tensor] - dictionary with corresponding field names and accumulated
values