serializatioin / deserialization and tests
This commit is contained in:
@@ -1,6 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <SimpleJSON/SerializableObject.h>
|
||||
#include <SimpleJSON/Factory.h>
|
||||
|
||||
#define NEURAL_NETWORK_REGISTER_ACTIVATION_FUNCTION(name,function) SIMPLEJSON_REGISTER(NeuralNetwork::ActivationFunction::Factory,name,function)
|
||||
/*public: \
|
||||
static const class __FACT_REGISTER_ {\
|
||||
public: \
|
||||
__FACT_REGISTER_() {\
|
||||
NeuralNetwork::ActivationFunction::Factory::registerCreator( #name ,function);\
|
||||
}\
|
||||
} __FACT_REGISTER;
|
||||
*/
|
||||
#define NEURAL_NETWORK_REGISTER_ACTIVATION_FUNCTION_FINISH(name,function) SIMPLEJSON_REGISTER_FINISH(NeuralNetwork::ActivationFunction::Factory,name,function)
|
||||
|
||||
namespace NeuralNetwork {
|
||||
namespace ActivationFunction {
|
||||
@@ -9,7 +21,7 @@ namespace ActivationFunction {
|
||||
* @author Tomas Cernik (Tom.Cernik@gmail.com)
|
||||
* @brief Abstract class of activation function
|
||||
*/
|
||||
class ActivationFunction {
|
||||
class ActivationFunction : public SimpleJSON::SerializableObject {
|
||||
public:
|
||||
|
||||
virtual ~ActivationFunction() {}
|
||||
@@ -41,11 +53,10 @@ namespace ActivationFunction {
|
||||
*/
|
||||
virtual ActivationFunction* clone() const = 0;
|
||||
|
||||
/**
|
||||
* @brief This is a virtual function for storing Activation function
|
||||
* @returns json describing function
|
||||
*/
|
||||
virtual std::string stringify() const =0;
|
||||
const static bool FORCE_REGISTER;
|
||||
};
|
||||
|
||||
typedef SimpleJSON::Factory<ActivationFunction> Factory;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user