serializatioin / deserialization and tests
This commit is contained in:
@@ -17,4 +17,16 @@ int main() {
|
||||
float res= a.computeOutput({1,0.7})[0];
|
||||
assert(res > solutions[i]*0.999 && res < solutions[i]*1.001);
|
||||
}
|
||||
|
||||
std::string str = a.stringify();
|
||||
std::cout << str << std::endl;;
|
||||
|
||||
//deserialize and check it!
|
||||
NeuralNetwork::Recurrent::Network *deserialized = (NeuralNetwork::Recurrent::Network::Factory::deserialize(str).release());
|
||||
for(size_t i=0;i<solutions.size();i++) {
|
||||
float res= a.computeOutput({1,0.7})[0];
|
||||
float resDeserialized= deserialized->computeOutput({1,0.7})[0];
|
||||
assert(fabs(resDeserialized-res) < 0.01);
|
||||
}
|
||||
delete deserialized;
|
||||
}
|
||||
Reference in New Issue
Block a user