graph-data
Create, validate, batch, slice, and convert Graph Nets graph data with GraphsTuple, data dictionaries, NumPy arrays, and NetworkX graphs.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- graph-data
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Create, validate, batch, slice, and convert Graph Nets graph data with GraphsTuple, data dictionaries, NumPy arrays, and NetworkX graphs.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md7.2 KB
- 参考文档references/data-formats.md6.9 KB
- 参考文档references/troubleshooting.md7.3 KB
- 脚本scripts/graph_data_smoke.py5.7 KB
03 SKILL.md 正文
Graph Data
Use this sub-skill when a task needs to build or inspect Graph Nets data before it reaches TensorFlow or Sonnet modules. It covers graphs.GraphsTuple, per-graph data dictionaries, NumPy arrays, NetworkX conversion, batching, unbatching, and slicing.
Read first
- Data formats: field semantics, valid
Nonecombinations, batch offsets, data dictionary rules, and NetworkX feature conventions. - API reference: exact NumPy conversion and slicing functions, expected inputs/outputs, and common preflight checks.
- Troubleshooting: fast diagnosis for key-set, endpoint, feature, and NetworkX compatibility failures.
- Smoke script: deterministic round-trip check that prints JSON and can be run from any working directory.
Typical workflows
- Create a
GraphsTupledirectly when arrays are already in batched form. Provide all seven fields:nodes,edges,receivers,senders,globals,n_node, andn_edge; keepn_nodeandn_edgenon-None. - Create from per-graph data dictionaries when each sample is easier to describe independently. Use
utils_np.data_dicts_to_graphs_tuple, and make every dictionary have the same non-Nonefield set. - Create from NetworkX when graph topology is naturally object-based. Use
utils_np.networkx_to_data_dictfor one graph orutils_np.networkxs_to_graphs_tuplefor a batch; enforce ordered integer node keys and the"features"attribute convention. - Round-trip or inspect a batch with
utils_np.graphs_tuple_to_data_dicts,utils_np.graphs_tuple_to_networkxs, orutils_np.get_graph. - Use
GraphsTuple.replaceorGraphsTuple.mapfor structural-preserving field updates; invalidNonecombinations still raise immediately.
Boundary routing
- TensorFlow placeholders, tensor batching, padding, specs,
tf.Sessionhandling, andutils_tfworkflows belong to tensorflow-ops. - Sonnet blocks, graph network modules, learned architecture choices, and model call requirements belong to graph-models.
- Long notebook-style training recipes belong to the root demo recipes and, for model construction, graph-models.
Minimum preflight checklist
- Confirm whether the graph is featureful or featureless separately for nodes, edges, and globals.
- Confirm
receiversandsendersare both present or both absent; featureless edges still need endpoints. - Confirm
n_nodeandn_edgeare present for manually constructedGraphsTupleobjects and for featureless/empty data dictionaries that cannot infer counts from arrays. - When batching, confirm all data dictionaries have identical non-
Nonekey sets, including number fields if any dictionary provides them. - When using NetworkX, confirm the runtime has
networkx.OrderedMultiDiGraphor another compatiblenetworkx<3graph class accepted by the conversion path.
04 同仓库更多 Skills
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.
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.
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.
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.
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.
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).