SubsetRepresentation
- class SubsetRepresentation(max_id: int, shape: int | Sequence[int] | None = None, base: str | Representation | type[Representation] | None = None, base_kwargs: Mapping[str, Any] | None = None, **kwargs)[source]
Bases:
Representation
A representation module, which only exposes a subset of representations of its base.
Note
At runtime, no index verification is made. Thus the only effect is based on the adjusted
max_id
.Initialize the representations.
- Parameters:
max_id (int) – The number of representations.
shape (OneOrSequence[int] | None) – The shape of an individual representation.
base (HintOrType[Representation]) – The base representation. Has to have a sufficient number of representations, i.e., at least
max_id
.base_kwargs (OptionalKwargs) – Additional keyword arguments for the base representation.
kwargs – Additional keyword-based parameters passed to
Representation
.
- Raises:
ValueError – if
max_id
is larger than the base representation’smax_id
Note
The parameter pair
(base, base_kwargs)
is used forpykeen.nn.representation_resolver
An explanation of resolvers and how to use them is given in https://class-resolver.readthedocs.io/en/latest/.