functional-conversion

Converts PyTorch MLP models to graph-format ONNX with pluggable backends and optimizers.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Converts PyTorch nn.Module classes to functional API style, removing class wrappers and self parameters to produce a concise, testable functional implementation for DSL generation.

Core Features & Use Cases

  • Functionalizes modules by replacing Module.forward calls with a module_fn that uses torch.nn.functional operations, preserving behavior.
  • Generates a minimal, testable functional model including imports, a Model(nn.Module) wrapper, and helper input getters for quick validation.
  • Enables DSL-based code generation, deployment, and reproducibility by providing a consistent functional interface across different ops via the provided references.

Quick Start

Convert a PyTorch nn.Module reference and its related references into a functional PyTorch implementation suitable for DSL pipelines.

Frequently Asked Questions about functional-conversion

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

FAQPage Schema
How do I convert PyTorch nn.Module to functional code for DSL generation?

You convert PyTorch nn.Module to functional code by removing class wrappers and replacing forward calls with torch.nn.functional operations via a module_fn, generating a minimal functional implementation suitable for DSL generation.

What is the functional API equivalent in PyTorch and when do I need it?

A PyTorch functional API equivalent replaces class-based nn.Module definitions with functional calls using torch.nn.functional operations, needed when simplifying model deployment and ensuring reproducibility in DSL environments.

Does converting nn.Module to a functional model preserve the original behavior?

Yes, converting nn.Module to a functional model preserves behavior and structure by replacing Module.forward calls with equivalent torch.nn.functional operations while removing the class-based wrapper.

Can I rewrite a PyTorch model to remove class wrappers for deployment?

Yes, you can rewrite a PyTorch model to remove class wrappers by generating a functional forward path using module_fn and functional calls, which directly supports model deployment in DSL environments.

What are the limitations of functionalizing PyTorch modules for DSL environments?

Functionalizing PyTorch modules requires reading input references and category-specific examples to generate the functional forward path, meaning modules lacking clear reference examples may face conversion limitations.