TensorFlow GNN

repository·main·Indexed 23 days ago

https://github.com/tensorflow/gnn

A library for building scalable graph neural networks in TensorFlow, optimized for heterogeneous graphs and large-scale data through distributed sampling. It features the GraphTensor data structure, a Runner Framework for model execution, and a collection of pre-defined models including GCN, GraphSAGE, GATv2, and Heterogeneous Graph Transformers (HGT). The library includes tools for data preparation via Beam samplers and training orchestration.

Tokens
178.4K
Snippets
345
Records
767
Agent score
80%

What's inside tensorflow-gnn

  1. Overview of TensorFlow GNN core components

    main

    TensorFlow GNN is a library designed for building Graph Neural Networks on the TensorFlow platform. Its core functionality includes:

    • tfgnn.GraphTensor: A specialized type used to represent graphs with a heterogeneous schema (supporting multiple types of nodes and edges).
    • Data Preparation: Includes tools like a graph sampler (notably the Beam sampler) to convert large databases into manageable subgraphs for training and inference.
    • Modeling: Provides a collection of ready-to-use models and Keras layers for custom GNN modeling.
    • Orchestration: A high-level API for managing the training process.
  2. Overview of TensorFlow GNN (TF-GNN)

    main

    TF-GNN is a library designed to simplify building Graph Neural Networks (GNNs) on graph data consisting of nodes and edges with arbitrary features.

    A core capability of TF-GNN is its native support for heterogeneous graphs, which are graphs containing multiple sets of nodes and multiple sets of edges, each with their own unique features. This is particularly useful for modeling complex real-world systems with different types of objects and relationships.

  3. Use tfgnn.keras.layers for GraphTensor operations

    main
    The tfgnn.keras.layers package provides a suite of Keras layers specifically designed for manipulating GraphTensor objects. These layers allow you to perform common GNN operations such as updating node/edge/context states, performing readouts, applying convolutions, and managing graph structure (like adding self-loops or padding) within a Keras model.
  4. Use the runner module for TF-GNN training and evaluation

    main

    The runner module provides a general-purpose framework for training and validating GNN models in TensorFlow GNN. It orchestrates the interaction between tasks, datasets, and trainers.

    Key components include:

    • run(...): The primary entry point to execute training and validation loops.
    • Task: Defines the learning objective (e.g., classification or regression) for the GNN.
    • Trainer: Handles the actual training and validation logic using Keras.
    • DatasetProvider: Provides the data via tf.data.Dataset.
    • RunResult: An object containing the results returned by the run(...) function.
  5. Explore TensorFlow GNN modules

    main

    The tfgnn package is organized into several key modules:

    • tfgnn.experimental: Contains experimental and unstable parts of the public interface.
    • tfgnn.keras: Provides Keras-specific integration and tools.
    • tfgnn.proto: Contains the protocol message (protobuf) types defined by TensorFlow GNN.
    • tfgnn.sampler: Provides the public interface for the GNN Sampler.
  6. Use Graph Attention Networks v2 (GATv2)

    main

    This implementation provides Graph Attention Networks v2 (GATv2), based on the paper "How Attentive are Graph Attention Networks?" (Brody et al., 2021).

    To use GATv2 in your TensorFlow programs, refer to the official API documentation for specific class signatures and initialization parameters.

  7. Use Graph Convolutional Networks (GCN) in TensorFlow GNN

    main

    This module provides an implementation of Graph Convolutional Networks (GCN) based on the paper "Semi-Supervised Classification with Graph Convolutional Networks" by Kipf and Welling (2016).

    To use the GCN implementation in your TensorFlow programs, refer to the official API documentation for specific class signatures and method calls.