Commit 82499e60 authored by xiang song(charlie.song)'s avatar xiang song(charlie.song) Committed by Minjie Wang
Browse files

[Bug Fix] Fix package reliability bug of networkx (#949)

* upd

* fig edgebatch edges

* add test

* trigger

* Update README.md for pytorch PinSage example.

Add noting that the PinSage model example under
example/pytorch/recommendation only work with Python 3.6+
as its dataset loader depends on stanfordnlp package
which work only with Python 3.6+.

* Provid a frame agnostic API to test nn modules on both CPU and CUDA side.

1. make dgl.nn.xxx frame agnostic
2. make test.backend include dgl.nn modules
3. modify test_edge_softmax of test/mxnet/test_nn.py and
    test/pytorch/test_nn.py work on both CPU and GPU

* Fix style

* Delete unused code

* Make agnostic test only related to tests/backend

1. clear all agnostic related code in dgl.nn
2. make test_graph_conv agnostic to cpu/gpu

* Fix code style

* fix

* doc

* Make all test code under tests.mxnet/pytorch.test_nn.py
work on both CPU and GPU.

* Fix syntex

* Remove rand

* Add TAGCN nn.module and example

* Now tagcn can run on CPU.

* Add unitest for TGConv

* Fix style

* For pubmed dataset, using --lr=0.005 can achieve better acc

* Fix style

* Fix some descriptions

* trigger

* Fix doc

* Add nn.TGConv and example

* Fix bug

* Update data in mxnet.tagcn test acc.

* Fix some comments and code

* delete useless code

* Fix namming

* Fix bug

* Fix bug

* Add test for mxnet TAGCov

* Add test code for mxnet TAGCov

* Update some docs

* Fix some code

* Update docs dgl.nn.mxnet

* Update weight init

* Fix

* reproduce the bug

* Fix concurrency bug reported at #755.
Also make test_shared_mem_store.py more deterministic.

* Update test_shared_mem_store.py

* Update dmlc/core

* networkx >= 2.4 will break our examples

* Update tutorials/requirements

* fix selfloop edges

* upd version
parent 98c1448b
......@@ -11,6 +11,7 @@ Pytorch implementation: https://github.com/Diego999/pyGAT
"""
import argparse
import networkx as nx
import time
import mxnet as mx
from mxnet import gluon
......@@ -58,7 +59,7 @@ def main(args):
# create graph
g = data.graph
# add self-loop
g.remove_edges_from(g.selfloop_edges())
g.remove_edges_from(nx.selfloop_edges(g))
g = DGLGraph(g)
g.add_edges(g.nodes(), g.nodes())
# create model
......
"""Training GCN model on citation graphs."""
import argparse, time
import numpy as np
import networkx as nx
import mxnet as mx
from mxnet import gluon
......@@ -54,7 +55,7 @@ def main(args):
# create GCN model
g = data.graph
if args.self_loop:
g.remove_edges_from(g.selfloop_edges())
g.remove_edges_from(nx.selfloop_edges(g))
g.add_edges_from(zip(g.nodes(), g.nodes()))
g = DGLGraph(g)
# normalization
......
import argparse, time
import numpy as np
import networkx as nx
import mxnet as mx
from mxnet import gluon
......@@ -52,7 +53,7 @@ def main(args):
g = data.graph
# add self loop
if args.self_loop:
g.remove_edges_from(g.selfloop_edges())
g.remove_edges_from(nx.selfloop_edges(g))
g.add_edges_from(zip(g.nodes(), g.nodes()))
g = DGLGraph(g)
......
......@@ -4,6 +4,7 @@ import time
import random
import numpy as np
import networkx as nx
import sklearn.preprocessing
import torch
import torch.nn as nn
......@@ -75,7 +76,7 @@ def main(args):
# create GCN model
g = data.graph
if args.self_loop and not args.dataset.startswith('reddit'):
g.remove_edges_from(g.selfloop_edges())
g.remove_edges_from(nx.selfloop_edges(g))
g.add_edges_from(zip(g.nodes(), g.nodes()))
print("adding self-loop edges")
g = DGLGraph(g, readonly=True)
......
import argparse, time
import numpy as np
import networkx as nx
import torch
import torch.nn as nn
import torch.nn.functional as F
......@@ -49,7 +50,7 @@ def main(args):
g = data.graph
# add self loop
if args.self_loop:
g.remove_edges_from(g.selfloop_edges())
g.remove_edges_from(nx.selfloop_edges(g))
g.add_edges_from(zip(g.nodes(), g.nodes()))
g = DGLGraph(g)
n_edges = g.number_of_edges()
......
......@@ -12,6 +12,7 @@ Pytorch implementation: https://github.com/Diego999/pyGAT
import argparse
import numpy as np
import networkx as nx
import time
import torch
import torch.nn.functional as F
......@@ -76,7 +77,7 @@ def main(args):
g = data.graph
# add self loop
g.remove_edges_from(g.selfloop_edges())
g.remove_edges_from(nx.selfloop_edges(g))
g = DGLGraph(g)
g.add_edges(g.nodes(), g.nodes())
n_edges = g.number_of_edges()
......
......@@ -7,6 +7,7 @@ References:
"""
import argparse, time, math
import numpy as np
import networkx as nx
import torch
import torch.nn as nn
import torch.nn.functional as F
......@@ -153,7 +154,7 @@ def main(args):
# graph preprocess and calculate normalization factor
g = data.graph
g.remove_edges_from(g.selfloop_edges())
g.remove_edges_from(nx.selfloop_edges(g))
g = DGLGraph(g)
# add self loop
g.add_edges(g.nodes(), g.nodes())
......
import argparse, time
import numpy as np
import networkx as nx
import torch
import torch.nn as nn
import torch.nn.functional as F
......@@ -62,7 +63,7 @@ def main(args):
g = data.graph
# add self loop
if args.self_loop:
g.remove_edges_from(g.selfloop_edges())
g.remove_edges_from(nx.selfloop_edges(g))
g.add_edges_from(zip(g.nodes(), g.nodes()))
g = DGLGraph(g)
n_edges = g.number_of_edges()
......
......@@ -8,6 +8,7 @@ import argparse
import time
import abc
import numpy as np
import networkx as nx
import torch
import torch.nn as nn
import torch.nn.functional as F
......@@ -96,7 +97,7 @@ def main(args):
# graph preprocess and calculate normalization factor
g = data.graph
g.remove_edges_from(g.selfloop_edges())
g.remove_edges_from(nx.selfloop_edges(g))
g = DGLGraph(g)
n_edges = g.number_of_edges()
......
......@@ -7,6 +7,7 @@ from dgl import DGLGraph
from dgl.data import register_data_args, load_data
from models import *
from conf import *
import networkx as nx
def get_model_and_config(name):
......@@ -82,7 +83,7 @@ def main(args):
g = data.graph
# add self loop
if args.self_loop:
g.remove_edges_from(g.selfloop_edges())
g.remove_edges_from(nx.selfloop_edges(g))
g.add_edges_from(zip(g.nodes(), g.nodes()))
g = DGLGraph(g)
n_edges = g.number_of_edges()
......
import argparse, time
import numpy as np
import networkx as nx
import torch
import torch.nn as nn
import torch.nn.functional as F
......@@ -60,8 +61,8 @@ def main(args):
g = data.graph
# add self loop
if args.self_loop:
g.remove_edges_from(g.selfloop_edges())
g.add_edges_from(zip(g.nodes(), g.nodes()))
g.remove_edges_from(nx.selfloop_edges(g))
g.add_edges_from(zip(g.nodes(), g.nodes()))
g = DGLGraph(g)
n_edges = g.number_of_edges()
......
......@@ -101,6 +101,7 @@ print(net)
# We load the cora dataset using DGL's built-in data module.
from dgl.data import citation_graph as citegrh
import networkx as nx
def load_cora_data():
data = citegrh.load_cora()
features = th.FloatTensor(data.features)
......@@ -108,7 +109,7 @@ def load_cora_data():
mask = th.ByteTensor(data.train_mask)
g = data.graph
# add self loop
g.remove_edges_from(g.selfloop_edges())
g.remove_edges_from(nx.selfloop_edges(g))
g = DGLGraph(g)
g.add_edges(g.nodes(), g.nodes())
return g, features, labels, mask
......
......@@ -274,6 +274,7 @@ class GAT(nn.Module):
from dgl import DGLGraph
from dgl.data import citation_graph as citegrh
import networkx as nx
def load_cora_data():
data = citegrh.load_cora()
......@@ -282,7 +283,7 @@ def load_cora_data():
mask = torch.ByteTensor(data.train_mask)
g = data.graph
# add self loop
g.remove_edges_from(g.selfloop_edges())
g.remove_edges_from(nx.selfloop_edges(g))
g = DGLGraph(g)
g.add_edges(g.nodes(), g.nodes())
return g, features, labels, mask
......
networkx
networkx>=2.1
torch
numpy
seaborn
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment