Skip to content

From scratch implementation of GCN and GAT layers in PyTorch using sparse format. Basically, we reproduce the PyTorch Geometric classes for GCN and GAT

License

Notifications You must be signed in to change notification settings

arturtoshev/from_gcn_to_gat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyTorch implementation of GCN and GAT on Cora

The notebook is organised as follows:

  1. The Cora dataset
  2. GCN: we build our own pytorch_geometric.nn.GCNConv layer.
  3. GAT: we build our own pytorch_geometric.nn.GATConv layer.

The main idea of this project is to learn how the GCN and GAT layers could be implemented in practice. Thus, the presented implementations are not too naive, but also not extremely optimized. If you don't have time to disect the PyG documentation and still want an useful GCN or GAT code, then you might want to check the notebook.

Setup

  1. Clone this repository
git clone https://github.com/arturtoshev/from_gcn_to_gat.git 
cd from_gcn_to_gat
  1. Create a virtual environment using virtualenv or
python3 -m venv ./venv
source venv/bin/activate
  1. You can work on the code with or without CUDA.
    • If you want to work with CUDA, you need the torch version corresponding to your cuda installation, see here. For CUDA 11.1 and torch 1.9.1 you can run pip install -r requirements_cu111.txt
    • If you don't mind waiting a couple of extra second or don't have CUDA, then try pip install -r requirements.txt, which is based on torch 1.9.1. Caution: CPU installation NOT TESTED!

Licence

License: MIT

About

From scratch implementation of GCN and GAT layers in PyTorch using sparse format. Basically, we reproduce the PyTorch Geometric classes for GCN and GAT

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published