OpenNN
Open-source neural networks library
Loading...
Searching...
No Matches
opennn::ModelExpression Class Reference

Emits a trained neural network as source code in C, Python, JavaScript, or PHP. More...

#include <model_expression.h>

Public Types

enum class  ProgrammingLanguage { C , Python , JavaScript , PHP }
 Output language for the generated expression source file. More...
 

Public Member Functions

 ModelExpression (const NeuralNetwork *)
 Builds an expression generator bound to the given trained neural network.
 
string build_expression () const
 Returns a symbolic mathematical expression representing the network's forward pass.
 
void save (const filesystem::path &, ProgrammingLanguage) const
 Writes a self-contained source file implementing the network in the chosen language.
 

Detailed Description

Emits a trained neural network as source code in C, Python, JavaScript, or PHP.

Member Enumeration Documentation

◆ ProgrammingLanguage

Output language for the generated expression source file.

Enumerator
Python 
JavaScript 
PHP 

Constructor & Destructor Documentation

◆ ModelExpression()

opennn::ModelExpression::ModelExpression ( const NeuralNetwork * )

Builds an expression generator bound to the given trained neural network.

Member Function Documentation

◆ build_expression()

string opennn::ModelExpression::build_expression ( ) const

Returns a symbolic mathematical expression representing the network's forward pass.

◆ save()

void opennn::ModelExpression::save ( const filesystem::path & ,
ProgrammingLanguage  ) const

Writes a self-contained source file implementing the network in the chosen language.

Parameters
pathDestination file path.
languageTarget programming language.