Skip to content

Commit

Permalink
Export expression inputs names
Browse files Browse the repository at this point in the history
  • Loading branch information
davidge807 committed Apr 5, 2023
1 parent da871be commit e28dbe1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions opennn/neural_network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5323,6 +5323,7 @@ string NeuralNetwork::write_expression_python() const
Tensor<string, 1> found_mathematical_expressions;

Tensor<string, 1> inputs = get_inputs_names();
Tensor<string, 1> original_inputs = get_inputs_names();
Tensor<string, 1> outputs = get_outputs_names();

const Index layers_number = get_layers_number();
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit e28dbe1

Please sign in to comment.