AGENT SKILL

transform-ops

Use VoxelMorph PyTorch tensor transform operations for affine, displacement, coordinate, warping, integration, resizing, composition, random transform, and module wrapper workflows.

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

01 前言 Front Matter

name
transform-ops
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Use VoxelMorph PyTorch tensor transform operations for affine, displacement, coordinate, warping, integration, resizing, composition, random transform, and module wrapper workflows.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

VoxelMorph transform operations

Use this sub-skill when the task is about VoxelMorph's PyTorch tensor transform primitives, not about model training or data generation. It covers dense displacement fields, affine transforms, coordinate normalization, spatial warping, scaling-and-squaring integration, displacement resizing/composition, random transform generation, and the module wrappers around these operations.

Use this for

  • Building 2D/3D affine matrices with voxelmorph.params_to_affine() or voxelmorph.random_affine().
  • Converting affine matrices to dense displacement fields with voxelmorph.affine_to_disp().
  • Converting among displacement fields, absolute transformation fields, and normalized sampling coordinates with disp_to_trf(), trf_to_disp(), and disp_to_coords().
  • Warping tensors with voxelmorph.spatial_transform() or voxelmorph.nn.functional.spatial_transform().
  • Integrating stationary velocity fields using scaling and squaring with integrate_disp() or IntegrateVelocityField.
  • Resizing/rescaling dense displacement fields with resize_disp() or ResizeDisplacementField.
  • Composing affine and dense transforms with compose().
  • Creating synthetic affine, displacement, or mixed random transforms for tests and augmentation-like utilities.
  • Using SpatialTransformer, IntegrateVelocityField, and ResizeDisplacementField inside PyTorch modules.

Do not use this for

  • Pairwise-registration model construction, loss selection, optimizer setup, training loops, checkpoints, or inference workflows; use the pairwise-registration sub-skill instead.
  • Volume loading, file I/O, batching, generator design, scan pair sampling, or data augmentation pipelines around datasets; use the data-generators sub-skill instead.
  • TensorFlow-era VoxelMorph APIs. This sub-skill describes the PyTorch branch behavior.

First routing decisions

  1. Choose the API layer. Use top-level voxelmorph functions for unbatched fields, affine utilities, and shape-agnostic transforms. Use voxelmorph.nn.functional when tensors are already in neural-network format (B, C, *spatial) for images and (B, ndim, *spatial) for fields. Use module wrappers when the operation belongs in an nn.Module graph.
  2. Normalize shape language. Dense fields are channels-first: (ndim, *spatial) or (B, ndim, *spatial). Image tensors use non_spatial_dims to identify leading channel/batch dimensions. Meshgrids are (ndim, *spatial) with ij indexing.
  3. Remember backward warping. spatial_transform() samples the source image at x + disp(x), so a positive displacement samples from a larger coordinate and can make visible image content move in the opposite direction.
  4. Treat coords_to_disp() as unavailable. It exists in both public layers but currently raises NotImplementedError; do not plan workflows that require the inverse normalized-coordinate conversion.
  5. Keep model and data responsibilities out. If the task starts asking for training, VxmPairwise, losses, volume readers, or generators, stop routing through this sub-skill.

Reference map

  • API reference: signatures, shape conventions, return types, and gotchas for voxelmorph.functional, voxelmorph.nn.functional, and module wrappers.
  • Workflows: copied/adapted runnable patterns for affine-to-displacement, warping, integration, resizing, composition, random transforms, and module use.
  • Troubleshooting: common assertion errors, axis/sign mistakes, interpolation issues, unavailable inverse conversion, random seeding, and composition limitations.
  • Smoke script: deterministic CPU/GPU-safe checks for core transform operations; run with python scripts/transform_ops_smoke.py --help from this sub-skill directory or with the script path from any project that has voxelmorph importable.

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