29 static const float kMinInputRange = 1e-6f;
40 template <
typename Type>
bool FeedForward(
const Type *inputs,
45 template <
typename Type>
bool GetNetOutput(
const Type *inputs,
115 template<
class ReadBuffType>
bool ReadBinary(ReadBuffType *input_buff) {
119 unsigned int read_val;
120 unsigned int auto_encode;
122 if (input_buff->Read(&read_val,
sizeof(read_val)) !=
sizeof(read_val)) {
128 if (input_buff->Read(&auto_encode,
sizeof(auto_encode)) !=
129 sizeof(auto_encode)) {
134 if (input_buff->Read(&read_val,
sizeof(read_val)) !=
sizeof(read_val)) {
144 if (input_buff->Read(&read_val,
sizeof(read_val)) !=
sizeof(read_val)) {
152 if (input_buff->Read(&read_val,
sizeof(read_val)) !=
sizeof(read_val)) {
172 for (
int node_idx = 0; node_idx <
neuron_cnt_; node_idx++) {
174 if (input_buff->Read(&read_val,
sizeof(read_val)) !=
sizeof(read_val)) {
178 int fan_out_cnt = read_val;
179 for (
int fan_out_idx = 0; fan_out_idx < fan_out_cnt; fan_out_idx++) {
181 if (input_buff->Read(&read_val,
sizeof(read_val)) !=
sizeof(read_val)) {
191 for (
int node_idx = 0; node_idx <
neuron_cnt_; node_idx++) {
252 #endif // NEURAL_NET_H__ void set_node_type(NeuronTypes type)
bool SetConnection(int from, int to)
static NeuralNet * FromFile(const string file_name)
static NeuralNet * FromInputBuffer(InputFileBuffer *ib)
bool FeedForward(const Type *inputs, Type *outputs)
vector< float > inputs_max_
bool FastFeedForward(const Type *inputs, Type *outputs)
bool FastGetNetOutput(const Type *inputs, int output_id, Type *output)
vector< vector< float > * > wts_vec_
static const int kWgtChunkSize
bool GetNetOutput(const Type *inputs, int output_id, Type *output)
vector< float > inputs_min_
bool ReadBinary(ReadBuffType *input_buff)
vector< float > inputs_std_dev_
static const unsigned int kNetSignature
vector< float > inputs_mean_
float * AllocWgt(int wgt_cnt)
vector< Node > fast_nodes_