tensorflow-ops
Operate on Graph Nets GraphsTuple objects backed by TensorFlow tensors.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- tensorflow-ops
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Operate on Graph Nets GraphsTuple objects backed by TensorFlow tensors.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md8.4 KB
- 参考文档references/troubleshooting.md8.2 KB
- 参考文档references/workflows.md6.9 KB
- 脚本scripts/tf_ops_smoke.py11.3 KB
03 SKILL.md 正文
TensorFlow GraphsTuple operations
Use this sub-skill when the task already has graph data in Graph Nets GraphsTuple
form, or has data dicts/NetworkX samples that must become TensorFlow-backed
GraphsTuple values for batching, slicing, padding, tf.function, or TF1
session feeding.
Route here for
- Building TensorFlow
GraphsTuples withutils_tf.data_dicts_to_graphs_tuple. - TF1 placeholder/feed workflows with
placeholders_from_data_dicts,placeholders_from_networkxs,get_feed_dict, andmake_runnable_in_session. - Eager/TF2 conversion and
tf.functionsignatures withnest_to_numpyandspecs_from_graphs_tuple. - Tensor GraphsTuple transforms:
concat,repeat,identity,stop_gradient,get_graph, andget_num_graphs. - Completing featureless graphs with fully connected edges or zero-valued node, edge, and global feature tensors.
- Fixed-size batching with
GraphsTupleSize,get_graphs_tuple_size,pad_graphs_tuple,remove_graphs_tuple_padding, andget_mask.
Route elsewhere
- For pure NumPy/NetworkX conversion or
utils_npround trips, use graph-data. - For Sonnet modules, Graph Nets blocks, learned message-passing constructors, and model factories, use graph-models.
Version decision
Choose the TensorFlow execution style before writing code:
- TF1 / Sonnet 1 stack: use
tf.Session, top-leveltf.placeholder,placeholders_from_*,get_feed_dict, andmake_runnable_in_sessionwhen a graph hasNonefields. - TF2 / Sonnet 2 stack: top-level
tf.Sessionandtf.placeholderare not available. Prefer eager tensors,utils_tf.nest_to_numpy, andutils_tf.specs_from_graphs_tuplefortf.functioninput signatures. Do not route TF2 users to placeholder APIs unless they explicitly own a compatible TF1-style runtime.
Operating procedure
- Normalize graph data into a
GraphsTuplewith tensor-valued fields. Keep NumPy/NetworkX-only conversion details in the graph-data sub-skill. - Ensure every selected utility's preconditions are true: matching non-
Nonefields forconcat, scalar integer graph indices forget_graph, complete fields forspecs_from_graphs_tuple, and enough padding capacity for a dummy graph when padding. - Add missing zero-valued feature tensors before model or
tf.functionuse when a utility rejectsNonefeature fields. - In TF1, convert
Nonefields withmake_runnable_in_sessionimmediately beforesess.run; in TF2, leaveNonefields as ordinary PythonNoneunless a utility explicitly requires tensors. - Use the bundled smoke script for a quick environment check:
python scripts/tf_ops_smoke.py --help, then run it in the intended Graph Nets TensorFlow environment.
References
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).