diff --git a/opennn/neural_network.cpp b/opennn/neural_network.cpp index 568f2501d..b7bb6ed2e 100644 --- a/opennn/neural_network.cpp +++ b/opennn/neural_network.cpp @@ -5323,6 +5323,7 @@ string NeuralNetwork::write_expression_python() const Tensor found_mathematical_expressions; Tensor inputs = get_inputs_names(); + Tensor original_inputs = get_inputs_names(); Tensor outputs = get_outputs_names(); const Index layers_number = get_layers_number(); @@ -5485,8 +5486,18 @@ string NeuralNetwork::write_expression_python() const } else { + std::string inputs_list; + for (int i = 0; i < original_inputs.size(); ++i) { + inputs_list += "'" + original_inputs(i) + "'"; + if (i < original_inputs.size() - 1) { + inputs_list += ", "; + } + } + buffer << "\t" << "def __init__(self):" << endl; buffer << "\t\t" << "self.inputs_number = " << to_string(inputs.size()) << endl; + buffer << "\t\t" << "self.inputs_names = [" << inputs_list << "]" << endl; + } buffer << "\n" << endl;