SLCWAInstances
- class SLCWAInstances(*, mapped_triples: Tensor, num_entities: int | None = None, num_relations: int | None = None, negative_sampler: str | NegativeSampler | type[NegativeSampler] | None = None, negative_sampler_kwargs: Mapping[str, Any] | None = None)[source]
Bases:
Instances
[tuple
[Tensor
,Tensor
,Tensor
|None
],SLCWABatch
]Training instances for the sLCWA.
Initialize the sLCWA instances.
- Parameters:
mapped_triples (MappedTriples) – shape: (num_triples, 3) the ID-based triples, passed to the negative sampler
num_entities (int | None) – >0 the number of entities, passed to the negative sampler
num_relations (int | None) – >0 the number of relations, passed to the negative sampler
negative_sampler (HintOrType[NegativeSampler]) – the negative sampler, or a hint thereof
negative_sampler_kwargs (OptionalKwargs) – additional keyword-based arguments passed to the negative sampler
Methods Summary
collate
(samples)Collate samples.
from_triples
(mapped_triples, *, ...)Create instances from mapped triples.
Get a collator.
Methods Documentation
- static collate(samples: Iterable[tuple[Tensor, Tensor, Tensor | None]]) SLCWABatch [source]
Collate samples.