gigl.src.common.models.utils.torch#

Functions#

to_hetero_feat(h, type_indices, types)

Convert homogeneous graph features into heterogeneous graph feature dict.

Module Contents#

gigl.src.common.models.utils.torch.to_hetero_feat(h, type_indices, types)[source]#

Convert homogeneous graph features into heterogeneous graph feature dict.

Parameters:
  • h (torch.Tensor) – feature tensor for a homogeneous graph

  • type_indices (torch.LongTensor) – indicates the type of each row in h, corresponding to types

  • types (list) – indicates the possible types

Return type:

Dict[gigl.src.common.types.graph_data.NodeType, torch.Tensor]

Returns

Dict[str, torch.Tensor]: dictionary mapping each type to a tensor of corresponding rows in the heterogeneous graph