AGENT SKILL

graph-nets

Use DeepMind Graph Nets for GraphsTuple data, TensorFlow graph utilities, and Sonnet graph-network modules.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
graph-nets
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Use DeepMind Graph Nets for GraphsTuple data, TensorFlow graph utilities, and Sonnet graph-network modules.
disable-model-invocation
true

02 资源文件 6

03 SKILL.md 正文

Graph Nets

Use this repo skill when a task uses DeepMind Graph Nets (graph_nets) to build graph neural networks in TensorFlow/Sonnet, manipulate GraphsTuple graph batches, convert NetworkX or NumPy graph data, or debug Graph Nets module and utility errors.

Read first

  • Repository provenance: read before deciding whether this skill is current for a checkout or package version.
  • Compatibility: choose TensorFlow 1/Sonnet 1 versus TensorFlow 2/Sonnet 2, and avoid incompatible NetworkX/TensorFlow stacks.
  • Troubleshooting: cross-cutting install/import, dependency, GPU, and version symptoms.
  • Demo recipes: distilled guidance from the tutorial, sorting, shortest-path, and physics notebooks without depending on the original notebooks.
  • Install check: safe JSON diagnostic for an installed graph_nets runtime.

Install and import check

Graph Nets does not declare TensorFlow as a package requirement, so choose a TensorFlow/Sonnet pair explicitly:

# TF2/Sonnet2-style workflows verified for this skill.
python -m pip install "graph_nets" "tensorflow>=2.2,<2.3" "dm-sonnet>=2,<3" "networkx<3" "protobuf<3.20" "numpy<1.20"

# Legacy TF1/Sonnet1-style workflows verified for this skill.
python -m pip install "graph_nets" "tensorflow>=1.15,<2" "dm-sonnet<2" "tensorflow_probability<0.9" "networkx<2.7" "protobuf<3.20" "numpy<1.20"

Then check:

python - <<'PY'
import graph_nets as gn
from graph_nets import graphs, utils_np, utils_tf, blocks, modules
print("graph_nets import ok")
PY

Use the bundled diagnostic when a user reports a version or import problem:

python path/to/graph-nets/scripts/check_graph_nets_install.py --pretty

Sub-skill routing

Task signal Read
Create, validate, batch, slice, or round-trip GraphsTuple data from dictionaries, NumPy arrays, or NetworkX graphs graph-data
Use utils_tf for tensor GraphsTuples, placeholders/feed dicts, concat, repeat, fully-connected graphs, padding/masks, tf.function signatures, or TF1/TF2 execution choices tensorflow-ops
Build or debug EdgeBlock, NodeBlock, GlobalBlock, GraphNetwork, GraphIndependent, InteractionNetwork, RelationNetwork, DeepSets, CommNet, SelfAttention, or demo model factories graph-models

Operating checklist

  1. Choose the runtime stack first. The TF1 stack exposes tf.Session and top-level tf.placeholder; the verified TF2 stack uses eager tensors and tf.function signatures and does not expose those top-level TF1 symbols.
  2. Normalize graph data before modeling. Use the graph-data sub-skill to enforce GraphsTuple field invariants, data dictionary key consistency, and NetworkX feature conventions.
  3. Move into TensorFlow utilities only after data is valid. Use the TensorFlow ops sub-skill for tensor conversion, padding, masks, session fetchability, or tf.function input signatures.
  4. Assemble modules with explicit field assumptions. Use graph-models when choosing use_* flags, reducers, Sonnet factories, or high-level message-passing architecture.
  5. Validate with tiny smoke checks before long demos. Full notebooks are interactive/training-scale; prefer the bundled scripts and selected native unit tests before attempting notebook reproduction.

Avoid this skill when

  • The task is about JAX graph networks; prefer Jraph or other JAX-specific guidance.
  • The task is about PyTorch Geometric, DGL, or generic NetworkX algorithms rather than Graph Nets GraphsTuple/TensorFlow/Sonnet APIs.
  • The task only edits this repository's packaging or contribution process and does not use Graph Nets as a library; use general Python repository maintenance guidance.
  • The task needs a modern TensorFlow/Keras GNN library with maintained TF 2.x APIs; Graph Nets is legacy and may require pinned dependencies.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351