mirror of https://github.com/davisking/dlib.git
merged
This commit is contained in:
commit
f47620c11f
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "running_gradient_abstract.h"
|
||||
#include "../algs.h"
|
||||
#include "../serialize.h"
|
||||
#include <cmath>
|
||||
#include "../matrix.h"
|
||||
|
||||
|
@ -115,6 +116,28 @@ namespace dlib
|
|||
return 1-probability_gradient_less_than(thresh);
|
||||
}
|
||||
|
||||
friend void serialize (const running_gradient& item, std::ostream& out)
|
||||
{
|
||||
int version = 1;
|
||||
serialize(version, out);
|
||||
serialize(item.n, out);
|
||||
serialize(item.R, out);
|
||||
serialize(item.w, out);
|
||||
serialize(item.residual_squared, out);
|
||||
}
|
||||
|
||||
friend void deserialize (running_gradient& item, std::ostream& in)
|
||||
{
|
||||
int version = 0;
|
||||
deserialize(version, in);
|
||||
if (version != 1)
|
||||
throw serialization_error("Unexpected version found while deserializing dlib::running_gradient.");
|
||||
deserialize(item.n, in);
|
||||
deserialize(item.R, in);
|
||||
deserialize(item.w, in);
|
||||
deserialize(item.residual_squared, in);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static double normal_cfd(double value, double mean, double stddev)
|
||||
|
|
|
@ -100,6 +100,22 @@ namespace dlib
|
|||
!*/
|
||||
|
||||
};
|
||||
|
||||
void serialize (
|
||||
const running_gradient& item,
|
||||
std::ostream& out
|
||||
);
|
||||
/*!
|
||||
provides serialization support
|
||||
!*/
|
||||
|
||||
void deserialize (
|
||||
running_gradient& item,
|
||||
std::istream& in
|
||||
);
|
||||
/*!
|
||||
provides serialization support
|
||||
!*/
|
||||
}
|
||||
|
||||
#endif // DLIB_RuNNING_GRADIENT_ABSTRACT_Hh_
|
||||
|
|
Loading…
Reference in New Issue