reference-generation

Generate a reference PyTorch nn.Module from operator description JSON.

33|51|Updated Mar 12, 2026
One-click install
npx skills add https://github.com/Just-it/AscendOpGenAgent --skill reference-generation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: reference-generation
Source: https://github.com/Just-it/AscendOpGenAgent/tree/main/skills/reference_generation
Command: npx skills add https://github.com/Just-it/AscendOpGenAgent --skill reference-generation

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Generate a reference PyTorch implementation from operator descriptions in JSON to establish a golden standard for testing and documentation.

Core Features & Use Cases

  • Generate a self-contained PyTorch module (nn.Module) along with get_inputs() and get_init_inputs() helpers based on the operator description.
  • Create a portable reference that can be used for regression testing, benchmarking, and as a design guide for downstream implementations.
  • Support exporting to a predictable output path like output/{op_name}_reference.py for easy integration into workflows.

Quick Start

Generate a reference PyTorch module from op_desc.json and save to output/{op_name}_reference.py.

Frequently Asked Questions about reference-generation

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

FAQPage Schema
How do I generate a PyTorch nn.Module from a JSON operator description?

To generate a PyTorch nn.Module from a JSON operator description, use this Skill to parse the JSON and output a standalone Model class with proper type hints. The resulting file serves as a golden standard for testing and benchmarking.

What is the best way to create get_inputs and get_init_inputs helpers for PyTorch benchmarking?

Creating get_inputs and get_init_inputs helpers for PyTorch benchmarking is handled automatically during reference code generation. The Skill structures these functions alongside the main nn.Module to provide standardized test inputs directly from the operator JSON.

Can I export generated PyTorch reference implementations to a specific output path?

Yes, you can export generated PyTorch reference implementations to a defined output path. The Skill supports saving the generated Python code predictably, such as to the output/{op_name}_reference.py file, for easy workflow integration.

Does the generated PyTorch reference code follow a standard Model(nn.Module) structure?

Yes, the generated PyTorch reference code strictly follows a Model(nn.Module) structure. This ensures the output is a self-contained, properly typed module that can be directly imported for regression testing or used as a design guide.

Why use a JSON operator description to create a PyTorch reference implementation?

Using a JSON operator description to create a PyTorch reference implementation establishes a portable golden standard for documentation and testing. It converts abstract specifications into executable code, ensuring consistent validation for downstream implementations.