Is there anyway to read the documentation?
Yonggie opened this issue · comments
Yonggie commented
Thanks for opensourcing such good contribution.
I wrote a test code like this:
import torch
import GCL.augmentors as A
aug=A.Compose([A.EdgeAdding(pe=0.4),A.FeatureDropout(pf=0.5)])
edge_index=torch.randint(0,10,(2,10))
x=torch.randn((10,128))
auged=aug(x,edge_index)
print(auged)
and it got this:
num_edges = edge_index.size()[1]
IndexError: tuple index out of range
It would be appreciated if anyone could help tell me how to read the documentation.
After I checked the code in add_edge
function in functional.py
, there could be a little problem with these piece of code:
def add_edge(edge_index: torch.Tensor, ratio: float) -> torch.Tensor:
num_edges = edge_index.size()[1]
num_nodes = edge_index.max().item() + 1
num_add = int(num_edges * ratio)
new_edge_index = torch.randint(0, num_nodes - 1, size=(2, num_add)).to(edge_index.device)
edge_index = torch.cat([edge_index, new_edge_index], dim=1)
# here it could be wrongly written. [0] might be removed.
edge_index = sort_edge_index(edge_index)[0]
return coalesce_edge_index(edge_index)[0]
Yanqiao ZHU commented
Thanks for your suggestion. Currently our team is busy with final examination and PhD application. We will try to add documentation as much as possible in late December.
Yanqiao ZHU commented
We have fixed this problem. Please check the develop
branch.