WeightBasis

class dgl.nn.pytorch.utils.WeightBasis(shape, num_bases, num_outputs)[source]

Bases: Module

Basis decomposition from Modeling Relational Data with Graph Convolutional Networks

It can be described as below:

Wo=βˆ‘b=1BaobVb

Each weight output Wo is essentially a linear combination of basis transformations Vb with coefficients aob.

If is useful as a form of regularization on a large parameter matrix. Thus, the number of weight outputs is usually larger than the number of bases.

Parameters:
  • shape (tuple[int]) – Shape of the basis parameter.

  • num_bases (int) – Number of bases.

  • num_outputs (int) – Number of outputs.

forward()[source]

Forward computation

Returns:

weight – Composed weight tensor of shape (num_outputs,) + shape

Return type:

torch.Tensor