HeteroLinearΒΆ
-
class
dgl.nn.pytorch.
HeteroLinear
(in_size, out_size, bias=True)[source]ΒΆ Bases:
torch.nn.modules.module.Module
Apply linear transformations on heterogeneous inputs.
- Parameters
Examples
>>> import dgl >>> import torch >>> from dgl.nn import HeteroLinear
>>> layer = HeteroLinear({'user': 1, ('user', 'follows', 'user'): 2}, 3) >>> in_feats = {'user': torch.randn(2, 1), ('user', 'follows', 'user'): torch.randn(3, 2)} >>> out_feats = layer(in_feats) >>> print(out_feats['user'].shape) torch.Size([2, 3]) >>> print(out_feats[('user', 'follows', 'user')].shape) torch.Size([3, 3])