UDAGCN icon indicating copy to clipboard operation
UDAGCN copied to clipboard

Tips for repoducing UDAGCN

Open Skyorca opened this issue 3 years ago • 1 comments

Now I'm trying to reproduce such beautiful work and hope to give some tips step by step:

  1. The code could work under pyg 2.0.2 by 1) replace direct calling read_txt_array in DomainData.py with functions defined by yourself because torch_geometric.io is descrepted. I put the source code below and 2) in cached_gcn_conv.py&ppmi_conv.py replace fill_value with 1./2. (turn from int to float) cauz add_self_loop( ) requires at least float type for fill_value.
def parse_txt_array(self, src, sep=None, start=0, end=None, dtype=None, device=None):
        src = [[float(x) for x in line.split(sep)[start:end]] for line in src]
        src = torch.tensor(src, dtype=dtype).squeeze()
        return src

def read_txt_array(self, path, sep=None, start=0, end=None, dtype=None, device=None):
    with open(path, 'r') as f:
        src = f.read().split('\n')[:-1]
    return self.parse_txt_array(src, sep, start, end, dtype, device)

For any further progress, I'll keep updating important tips

Skyorca avatar Nov 25 '21 08:11 Skyorca

remove "os.environ["CUDA_VISIBLE_DEVICES"]" in UDAGCN_demo.py so as to use GPU :)

Skyorca avatar Mar 15 '22 06:03 Skyorca