AGENT SKILL

attention-and-hetero-layers

Guides PyTorch Geometric Temporal attention-based temporal graph layers and heterogeneous recurrent layers, with model selection, tensor layouts, and smoke checks.

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

01 前言 Front Matter

name
attention-and-hetero-layers
license
MIT
metadata
{ "disco-role": "operating" }
description
Guides PyTorch Geometric Temporal attention-based temporal graph layers and heterogeneous recurrent layers, with model selection, tensor layouts, and smoke checks.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

Attention and Heterogeneous Temporal Layers

Use this sub-skill when a task involves PyTorch Geometric Temporal attention/STGCN-style layers, MTGNN/GMAN/AAGCN/DNNTSP models, or the heterogeneous HeteroGCLSTM layer. Keep this file as a router; read the bundled references for signatures, layouts, and complete wiring patterns.

Read this when

  • The user names TemporalConv, STConv, ASTGCN, MSTGCN, GMAN, MTGNN, AAGCN, DNNTSP, ChebConvAttention, MixProp, GraphConstructor, GraphAAGCN, SpatioTemporalEmbedding, SpatioTemporalAttention, or HeteroGCLSTM.
  • The user is converting traffic tensors for STGCN/ASTGCN/MSTGCN/GMAN/MTGNN and needs the correct axis order.
  • The user has heterogeneous PyG data (x_dict, edge_index_dict, metadata) and wants a recurrent hidden/cell-state update per node type.
  • The user asks whether a class is a high-level forecasting/model block or a lower-level building block.

Route elsewhere when

  • The layer is recurrent-only (GConvGRU, DCRNN, TGCN, A3TGCN, AGCRN, MPNNLSTM, etc.): route to recurrent-layers.
  • The task is loading or downloading benchmark datasets: route to dataset-loaders first, then return here only after tensors are prepared.
  • The task is constructing or splitting temporal signal iterators: route to temporal-signals.
  • The task is memory-efficient index batching, Dask-DDP, or get_index_dataset: route to index-batching.
  • The user wants a full notebook case study: distill the relevant pattern into one of the workflows here instead of copying or depending on notebooks.

First decision: choose the model family

User intent Start with Why
STGCN block over [batch, time, nodes, features] traffic windows TemporalConv or STConv STConv combines two temporal convolutions with a Chebyshev graph convolution; TemporalConv is only the temporal gated-conv block.
Attention-based traffic forecasting with spatial and temporal attention ASTGCN High-level ASTGCN model; use ChebConvAttention only for custom blocks.
ASTGCN-like traffic forecasting without explicit attention modules MSTGCN High-level multi-component STGCN variant.
GMAN-style multi-attention traffic prediction GMAN High-level model that consumes spatial embeddings and integer-coded temporal embeddings.
Multivariate time-series graph learning with adaptive adjacency MTGNN High-level model; MixProp and GraphConstructor are helper blocks.
Skeleton/action style spatio-temporal graph convolution AAGCN High-level 2S-AGCN block; GraphAAGCN only builds its three-channel adjacency tensor.
Temporal set prediction DNNTSP High-level temporal-set model; expect item-batched node features.
Heterogeneous temporal recurrence HeteroGCLSTM Heterogeneous graph convolutional LSTM cell returning hidden/cell dictionaries.

Layout warning before coding

The most common failure is transposing the wrong axes. Confirm the target class before creating tensors:

  • TemporalConv and STConv: input is [B, T, N, F] and output keeps [B, T_out, N, F_out].
  • ASTGCN and MSTGCN: input is [B, N, F, T]; output is [B, N, num_for_predict].
  • GMAN: X is [B, num_his, N]; SE is [N, K*d]; TE is [B, num_his + num_pred, 2] with day-of-week and time-of-day integer codes.
  • MTGNN and helpers: input is channel-first [B, in_dim, N, seq_length].
  • AAGCN: input is [B, F, T, N].
  • HeteroGCLSTM: use PyG-style dictionaries (x_dict, edge_index_dict) plus metadata=(node_types, edge_types).

Bundled references and script

Minimal operating pattern

  1. Pick the owning model family from the table above.
  2. Convert tensors to that class's required layout before constructing the model.
  3. Keep dataset loading, temporal-signal iteration, and index-batching mechanics outside this sub-skill.
  4. Add a small assertion on output shape before training; for quick environment checks, run the bundled smoke script.
  5. If a model is large (ASTGCN, MSTGCN, GMAN, MTGNN, DNNTSP), start with tiny synthetic dimensions and mark any full training or traffic benchmark run as optional/expensive.

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