gnn-code-generation

Generate multi-framework code from GNN specifications across PyMDP, RxInfer.jl, ActiveInference.jl, JAX, and DisCoPy.

30|3|Updated Apr 2, 2023
One-click install
npx skills add https://github.com/ActiveInferenceInstitute/GeneralizedNotationNotation --skill gnn-code-generation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gnn-code-generation
Source: https://github.com/ActiveInferenceInstitute/GeneralizedNotationNotation/tree/main/src/render
Command: npx skills add https://github.com/ActiveInferenceInstitute/GeneralizedNotationNotation --skill gnn-code-generation

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pypdf, pdfplumber, pdf2image.

What problem does it solve?

Generates multi-framework code from GNN specifications to accelerate simulation development and deployment across PyMDP, RxInfer.jl, ActiveInference.jl, JAX, and DisCoPy.

Core Features & Use Cases

  • POMDP-aware rendering: extracts A, B, C, D (and optional E) from GNNs and generates framework-specific implementations.
  • Cross-framework support: produces Python and Julia code artifacts for PyMDP, RxInfer.jl, ActiveInference.jl, JAX, and DisCoPy, with optional backends like PyTorch, NumPyro, and Stan.
  • Model-to-code pipelines and validation: normalizes matrices, validates shapes, writes rendering summaries and per-model documentation.

Quick Start

Render all GNN files in input/gnn_files to output with all frameworks using the default configuration.

Frequently Asked Questions about gnn-code-generation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate code from GNN specifications across multiple frameworks?

To generate code from GNN specifications, provide A, B, C, and D matrices (with optional E) in the input spec. The tool extracts these POMDP parameters, normalizes matrices, and outputs per-model artifacts for PyMDP, RxInfer.jl, ActiveInference.jl, JAX, and DisCoPy.

What frameworks are supported for multi-framework code generation from POMDP models?

Multi-framework code generation supports Python and Julia artifacts for PyMDP, RxInfer.jl, ActiveInference.jl, JAX, and DisCoPy. It can also produce optional backends including PyTorch, NumPyro, and Stan for your generated POMDP implementations.

Does GNN code generation require specific POMDP matrices to render correctly?

Yes, GNN code generation requires A, B, C, and D matrices in the specification to render correctly. The optional E matrix can also be included. The tool normalizes these matrices to stochastic and consistent forms before generating framework-specific code.

How does matrix normalization work when converting GNN files to simulation code?

When converting GNN files to simulation code, matrix normalization validates shapes and transforms A, B, C, and D matrices into stochastic and consistent forms. This ensures the generated per-framework code artifacts are mathematically valid for deployment.

Can I use PyMDP or RxInfer.jl backends for simulation code generated from GNN files?

Yes, you can use PyMDP or RxInfer.jl backends for simulation code generated from GNN files. The tool produces cross-framework Python and Julia code artifacts with per-model documentation to accelerate simulation development and deployment.

Why does my generated JAX or DisCoPy code fail due to unnormalized POMDP matrices?

Generated JAX or DisCoPy code fails if the input GNN spec lacks properly formatted A, B, C, and D matrices. The tool normalizes matrices to stochastic forms, but invalid or missing input shapes will prevent successful per-framework code generation.