CombinedCompGCN表示
- class CombinedCompGCNRepresentations(*, triples_factory: CoreTriplesFactory, entity_representations: str | Representation | type[Representation] | None = None, entity_representations_kwargs: Mapping[str, Any] | None = None, relation_representations: str | Representation | type[Representation] | None = None, relation_representations_kwargs: Mapping[str, Any] | None = None, num_layers: int | None = 1, dims: None | int | Sequence[int] = None, layer_kwargs: Mapping[str, Any] | None = None)[源代码]
基础类:
Module一系列CompGCN层。
初始化组合实体和关系表示模块。
- Parameters:
triples_factory (CoreTriplesFactory) – 包含训练三元组的三元组工厂。
entity_representations (HintOrType[Representation]) – 基础实体表示
entity_representations_kwargs (OptionalKwargs) – 基础实体表示的额外关键字参数
relation_representations (HintOrType[Representation]) – 基础关系表示
relation_representations_kwargs (OptionalKwargs) – 基础关系表示的额外关键字参数
num_layers (int | None) – 使用的消息传递层数。如果为None,将通过len(dims)推断,即要求dims为序列/列表。
dims (None | int | Sequence[int]) – 要使用的隐藏维度。如果为None,则默认为基础表示的嵌入维度。 如果是整数,则所有层都相同。最后一个维度等于输出维度。
layer_kwargs (Mapping[str, Any] | None) – 传递给各个层的额外基于关键字的参数;参见 CompGCNLayer。
- Raises:
ValueError – 对于几种无效的参数组合: 1. 如果维度以整数形式给出,但没有给出层数 2. 如果维度以列表形式给出,但与给定的层数不匹配
方法总结
forward()计算丰富的表示。
split()返回分离的表示。
train([mode])将模块设置为训练模式。
方法文档
- split() tuple[SingleCompGCNRepresentation, SingleCompGCNRepresentation][来源]
返回分离的表示。
- Return type:
tuple[SingleCompGCNRepresentation, SingleCompGCNRepresentation]