serializatioin / deserialization and tests
This commit is contained in:
@@ -29,11 +29,18 @@ namespace ActivationFunction {
|
||||
return new Sigmoid(lambda);
|
||||
}
|
||||
|
||||
virtual std::string stringify() const override {
|
||||
return "{ \"class\": \"NeuralNetwork::ActivationFunction::Sigmoid\", \"lamba\" : "+std::to_string(lambda)+"}";
|
||||
virtual SimpleJSON::Type::Object serialize() const override {
|
||||
return {{"class", "NeuralNetwork::ActivationFunction::Sigmoid"}, {"lambda", lambda}};
|
||||
}
|
||||
|
||||
static std::unique_ptr<Sigmoid> deserialize(const SimpleJSON::Type::Object &obj) {
|
||||
return std::unique_ptr<Sigmoid>(new Sigmoid(obj["lambda"].as<double>()));
|
||||
}
|
||||
|
||||
protected:
|
||||
float lambda;
|
||||
|
||||
NEURAL_NETWORK_REGISTER_ACTIVATION_FUNCTION(NeuralNetwork::ActivationFunction::Sigmoid, Sigmoid::deserialize)
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user