cogdl.models.nn.compgcn

Module Contents

Functions

com_mult(a, b)

Borrowed from https://github.com/malllabiisc/CompGCN

conj(a)

Borrowed from https://github.com/malllabiisc/CompGCN

ccorr(a, b)

Borrowed from https://github.com/malllabiisc/CompGCN

cogdl.models.nn.compgcn.com_mult(a, b)[source]

Borrowed from https://github.com/malllabiisc/CompGCN

cogdl.models.nn.compgcn.conj(a)[source]

Borrowed from https://github.com/malllabiisc/CompGCN

cogdl.models.nn.compgcn.ccorr(a, b)[source]

Borrowed from https://github.com/malllabiisc/CompGCN

class cogdl.models.nn.compgcn.BasesRelEmbLayer(num_bases, num_rels, in_feats)[source]

Bases: torch.nn.Module

reset_parameters(self)[source]
forward(self)[source]
class cogdl.models.nn.compgcn.CompGCNLayer(in_feats, out_feats, num_rels, opn='mult', num_bases=None, activation=lambda x: ..., dropout=0.0, bias=True)[source]

Bases: torch.nn.Module

get_param(self, num_in, num_out)[source]
forward(self, x, edge_index, edge_type, rel_embed=None)[source]
message_passing(self, x, rel_embed, edge_index, edge_types, mode, edge_weight=None)[source]
rel_transform(self, ent_embed, rel_embed)[source]
class cogdl.models.nn.compgcn.CompGCN(num_entities, num_rels, num_bases, in_feats, hidden_size, out_feats, layers, dropout, activation)[source]

Bases: torch.nn.Module

forward(self, x, edge_index, edge_types)[source]
class cogdl.models.nn.compgcn.LinkPredictCompGCN(num_entities, num_rels, hidden_size, num_bases=0, layers=1, sampling_rate=0.01, score_func='conve', penalty=0.001, dropout=0.0, lbl_smooth=0.1)[source]

Bases: cogdl.layers.link_prediction_module.GNNLinkPredict, cogdl.models.BaseModel

static add_args(parser)[source]

Add model-specific arguments to the parser.

classmethod build_model_from_args(cls, args)[source]

Build a new model instance.

add_reverse_edges(self, edge_index, edge_types)[source]
forward(self, edge_index, edge_types)[source]
loss(self, data, split='train')[source]
predict(self, edge_index, edge_types)[source]