AGENT SKILL

recurrent-layers

Guide PyTorch Geometric Temporal recurrent graph layer selection, shape/state contracts, and tiny forecasting smoke tests.

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

01 前言 Front Matter

name
recurrent-layers
license
MIT
metadata
{ "disco-role": "operating" }
description
Guide PyTorch Geometric Temporal recurrent graph layer selection, shape/state contracts, and tiny forecasting smoke tests.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

recurrent-layers

Use this sub-skill when the user is building, debugging, or smoke-testing a PyTorch Geometric Temporal model whose core temporal operator is a recurrent graph layer.

Trigger phrases

Load this sub-skill for requests such as:

  • "use GConvGRU/GConvLSTM/GCLSTM/DCRNN/TGCN/A3TGCN for forecasting"
  • "what shape should H, C, lambda_max, periods, or batch tensors have?"
  • "add a torch.nn.Linear head after a recurrent temporal layer"
  • "preserve hidden state across temporal snapshots" or "reset recurrent state between graph sequences"
  • "make a tiny CPU smoke test for recurrent temporal graph layers"
  • "convert a recurrent example into a no-download synthetic training loop"

Covered layer families

This sub-skill covers the recurrent exports in torch_geometric_temporal.nn.recurrent:

  • Chebyshev recurrent cells: GConvGRU, GConvLSTM, GCLSTM.
  • Diffusion recurrent cells: DCRNN, BatchedDCRNN.
  • Temporal GCN cells: TGCN, TGCN2, A3TGCN, A3TGCN2.
  • Relational/evolution/embedding recurrent cells: LRGCN, DyGrEncoder, EvolveGCNH, EvolveGCNO, MPNNLSTM, AGCRN.

The recurrent layers return hidden representations and states. They do not include the final forecasting/classification nonlinearity, loss, metric, optimizer, or task head unless explicitly stated by that layer. Add torch.nn.functional.relu, dropout, and torch.nn.Linear heads in the surrounding model when the task needs them.

Boundaries and routing

Stay in this sub-skill for recurrent temporal graph layer selection, forward-call signatures, state management, shape debugging, and the bundled synthetic smoke script.

Route elsewhere when the user's main question is about:

  • Attention-only or heterogeneous graph attention layers such as STConv, ASTGCN, MSTGCN, GMAN, MTGNN, AAGCN, DNNTSP, or HeteroGCLSTM: use attention-and-hetero-layers.
  • Choosing and configuring real benchmark dataset loaders: use dataset-loaders.
  • Constructing temporal signal iterators and temporal_signal_split: use temporal-signals.
  • IndexDataset, get_index_dataset, index-batching tuple unpacking, or Dask-DDP: use index-batching.

First steps for model-building

  1. Identify the snapshot shape: ordinary snapshots use node features X shaped [num_nodes, in_channels]; batched recurrent variants use batch-aware shapes such as [batch_size, num_nodes, in_channels] or [batch_size, sequence_length, num_nodes, in_channels].
  2. Pick the layer whose state contract matches the data layout. Read API reference before writing forward calls.
  3. Add a task head outside the recurrent layer. A common forecasting head is hidden = F.relu(hidden); prediction = torch.nn.Linear(hidden_dim, target_dim)(hidden).
  4. Decide whether each independent temporal sequence resets H/C to None, or whether the returned state is passed into the next snapshot. Read workflow recipes for both patterns.
  5. Run the bundled synthetic recurrent smoke script before adapting long examples or network-backed datasets.

Quick checks

  • edge_index is always a long tensor shaped [2, num_edges].
  • edge_weight is a float tensor shaped [num_edges] when provided. Some diffusion/batched helpers need explicit weights; use ones for an unweighted synthetic graph.
  • Chebyshev layers with non-symmetric normalization (normalization=None or "rw") require lambda_max in forward.
  • A3TGCN expects X shaped [num_nodes, in_channels, periods]; A3TGCN2 expects [batch_size, num_nodes, in_channels, periods].
  • AGCRN uses node embeddings E shaped [num_nodes, embedding_dimensions] instead of edge_index.

Runtime references

  • API reference: constructor and forward signatures, shape contracts, state returns, and layer-specific cautions.
  • Workflow recipes: snapshot loops, explicit heads and losses, hidden-state reset/preserve choices, batched TGCN2/A3TGCN2 patterns, and optional Lightning caveats.
  • Troubleshooting: shape mismatches, missing weights, Chebyshev lambda_max, batch_size/periods mistakes, state leaks, and network-heavy example caveats.
  • Synthetic smoke script: deterministic CPU-only recurrent layer smoke with --help and --layer choices.

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