Download annotations/annotation_15/GraphMETRO/graphmetro/transform/utils.py from mcy98/RECODE-H: direct link, hf CLI and curl.
- Browser
- Download file 686 Bytes
-
https://huggingface.co/datasets/mcy98/RECODE-H/resolve/main/annotations/annotation_15/GraphMETRO/graphmetro/transform/utils.py
- Command line
-
hf download hf://datasets/mcy98/RECODE-H/annotations/annotation_15/GraphMETRO/graphmetro/transform/utils.py
-
curl -L -o utils.py https://huggingface.co/datasets/mcy98/RECODE-H/resolve/main/annotations/annotation_15/GraphMETRO/graphmetro/transform/utils.py
686 Bytes
| import torch.nn as nn | |
| class Compose(nn.Module): | |
| def __init__(self, transforms): | |
| super().__init__() | |
| self.transforms = transforms | |
| def forward(self, x, edge_index, edge_attr, batch): | |
| _info = {} | |
| for aug in self.transforms: | |
| x, edge_index, edge_attr, batch, info = aug(x, edge_index, edge_attr, batch) | |
| if not info is None: | |
| for key, item in info.items(): | |
| if 'node_mask' in _info.keys() and key == 'node_mask': | |
| _info[key][_info[key] == 1] = item | |
| else: | |
| _info[key] = item | |
| return x, edge_index, edge_attr, batch, _info |