Giter Club home page Giter Club logo

gcn-tf2.0's Introduction

GCN-TF2.0

This is the vanilla implementation of graph convolution networks (GCN) with tensorflow 2.x.

Instead of the Keras API, this implementation take the GradientTape as the optimization process.

No placeholder, no tf.app, tf.flags, and some APIs deprecated after TF 2.x.

Reference: Semi-Supervised Classification with Graph Convolutional Networks.

Parts of the code coming from the author's original implementation code.

Credits to Thomas Kipf. Thanks.

usage

python train.py [options]

You can specify the options as

  --dataset, choosing from 'citeseer', 'cora', 'cora_ml', 'pubmed', 'polblogs' and 'dblp'

Check out the train.py for more detailed arguments.

LICENSE

The project is under MIT license.

gcn-tf2.0's People

Contributors

cshjin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gcn-tf2.0's Issues

Consider to a sparse-sparse matmul case

Overall, if we have two sparse matrices, then the multiplication should be sparse as well, in order to improve the performance.
Example like https://github.com/scipy/scipy/blob/a03f15fe43cb68c132192af22deb73b69ef201bf/scipy/sparse/compressed.py#L496-L530
And the spspmm function in the pytorch-sparse package. https://github.com/rusty1s/pytorch_sparse/blob/master/torch_sparse/spspmm.py

While in TF2.x, no matter the matmul (sparsetensor, sparsetensor) or the sparse.sparse_dense_matmul(sparsetensor, tensor) function return a Tensor instead of SparseTensor.

This is the one of the reasons why the PyG is much faster in the implementation of tensorflow or DGL.

Performance issue need to be resolved.

How to save and load the GradientTape model

Trying to save with:
tf.saved_model.save(gcn, "trained_model/")

Gives the below error:

Traceback (most recent call last):
File "train_gcn.py", line 81, in
app.run(main)
File "/home/mtare/Documents/Projects/document-trainer-gcn/venv/lib/python3.6/site-packages/absl/app.py", line 299, in run
_run_main(main, args)
File "/home/mtare/Documents/Projects/document-trainer-gcn/venv/lib/python3.6/site-packages/absl/app.py", line 250, in _run_main
sys.exit(main(argv))
File "train_gcn.py", line 70, in main
tf.saved_model.save(gcn, "trained_model/")
File "/home/mtare/Documents/Projects/document-trainer-gcn/venv/lib/python3.6/site-packages/tensorflow/python/saved_model/save.py", line 951, in save
obj, export_dir, signatures, options, meta_graph_def)
File "/home/mtare/Documents/Projects/document-trainer-gcn/venv/lib/python3.6/site-packages/tensorflow/python/saved_model/save.py", line 1001, in _build_meta_graph
"Expected a Trackable object for export, got {}.".format(obj))
ValueError: Expected a Trackable object for export, got <models.gcn.GCN object at 0x7fd6651fd908>.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.