ComposeΒΆ
-
class
dgl.transforms.
Compose
(transforms)[source]ΒΆ Bases:
dgl.transforms.module.BaseTransform
Create a transform composed of multiple transforms in sequence.
- Parameters
transforms (list of Callable) β A list of transform objects to apply in order. A transform object should inherit
BaseTransform
and implement__call__()
.
Example
>>> import dgl >>> from dgl import transforms as T
>>> g = dgl.graph(([0, 0], [1, 1])) >>> transform = T.Compose([T.ToSimple(), T.AddReverse()]) >>> new_g = transform(g) >>> print(new_g.edges()) (tensor([0, 1]), tensor([1, 0]))