gromov
Use POT Gromov-Wasserstein and Fused GW solvers for graphs, structured data, heterogeneous spaces, GW barycenters, dictionary learning, quantized approximations, and validation.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- gromov
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use POT Gromov-Wasserstein and Fused GW solvers for graphs, structured data, heterogeneous spaces, GW barycenters, dictionary learning, quantized approximations, and validation.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md16.8 KB
- 参考文档references/troubleshooting.md10.1 KB
- 参考文档references/workflows.md11.2 KB
- 脚本scripts/gromov_smoke.py9.0 KB
03 SKILL.md 正文
POT Gromov-Wasserstein and Fused GW
Use this sub-skill when the task involves comparing or aligning objects whose samples live in different metric spaces or have graph/relational structure: Gromov-Wasserstein (GW), Fused Gromov-Wasserstein (FGW), structured graph matching, node-feature-aware graph comparison, GW/FGW barycenters, dictionary learning/unmixing, semirelaxed/partial/unbalanced variants, quantized approximations, and GW validation.
Read references/api-reference.md when choosing a POT GW API, checking verified signatures/defaults, understanding ot.solve_gromov versus ot.gromov.*, or validating expected plan/log/result fields.
Read references/workflows.md when building an end-to-end GW or FGW workflow for graphs, node features, heterogeneous spaces, barycenters, dictionary learning, or approximate/quantized GW.
Read references/troubleshooting.md when cost matrices, weights, loss_fun/loss, alpha, marginal constraints, symmetric, partial/semirelaxed/unbalanced semantics, convergence, quantized helpers, or optional GNN dependencies fail.
Run scripts/gromov_smoke.py after installing POT to exercise deterministic NumPy GW and FGW fixtures with no plotting, downloads, original checkout, or optional graph dependencies.
Route quickly
- Use GW when each object is represented only by an internal structure matrix (
C1,C2), such as pairwise graph distances, adjacency-derived dissimilarities, shape geodesics, or relational similarities. - Use FGW when structures also have cross-space attributes or node features. Provide a feature cost matrix
Mof shape(n_source, n_target)and tunealpha:0emphasizes features/linear OT and1emphasizes pure GW structure. - Use
ot.solve_gromovfor a unifiedOTResultwith.plan,.value,.value_linear,.value_quad, and marginal helpers. Useot.gromov.*functions when you need a specific classical, entropic, semirelaxed, partial, quantized, barycenter, dictionary, or estimator API. - Use entropic GW/FGW when exact conditional-gradient plans are too slow or too sparse and a smoother approximation is acceptable.
- Use semirelaxed GW/FGW when the source marginal is fixed but the target-side mass may be reweighted, for example matching a graph to a prototype or community structure.
- Use partial GW/FGW when only a known amount of mass should match, such as subgraph matching with outliers.
- Use fused unbalanced GW when marginal masses should be penalized rather than enforced. Route general unbalanced/partial OT fundamentals to
unbalanced-partial. - Use quantized, sampled, pointwise, or low-rank GW when graph/sample sizes make full GW too expensive; validate the approximation on a reduced problem before trusting ranking or downstream decisions.
- Use GW/FGW barycenters when the output is itself a structure matrix or an attributed graph prototype. Route ordinary Wasserstein barycenters to
barycenters. - Use dictionary learning/unmixing when many structured samples should be represented as convex combinations of learned GW/FGW atoms.
- Treat POT GNN layers (
ot.gnn) as optional reference-only functionality unless the user's environment has PyTorch and PyTorch Geometric installed and verified. Route backend installation and batch-array issues tobackend-and-batch.
Stay in scope
This sub-skill owns structured GW/FGW modeling, solver selection, validation, and workflow-specific recovery. It does not cover ordinary vector-space OT except as the M term inside FGW; route those tasks to core-solvers. It does not teach general mass-relaxation theory outside GW/FGW; route that to unbalanced-partial. It does not install optional backend stacks, PyTorch Geometric, plotting, NetworkX, or scikit-learn; route setup questions to backend-and-batch or keep them explicitly optional.
Minimal operating checklist
- Build finite floating-point square structure matrices
C1andC2; normalize scales when comparing multiple costs. - If using FGW, build
Mwith shape(C1.shape[0], C2.shape[0])from comparable node-feature distances. - Set one-dimensional nonnegative weights
pandqwhose lengths match the structure matrices, or let POT use uniform weights. - Choose the mass model: balanced GW/FGW, semirelaxed target reweighting, partial transported mass, or unbalanced marginal penalty.
- Run the solver with explicit
loss_fun/loss,alpha,reg,symmetric,max_iter, andtolwhen reproducibility matters. - Validate the returned plan: finite nonnegative values, expected shape, total mass, row/column marginal behavior for the selected mass model, and a finite GW/FGW value.
- For larger graphs, compare an approximate/quantized result against a tiny exact subset or the bundled smoke script before scaling up.
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).