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)) {
165 }
else if (idx >= (neuron_cnt_ -
out_cnt_)) {
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__
static NeuralNet * FromInputBuffer(InputFileBuffer *ib)
vector< Node > fast_nodes_
vector< float > inputs_mean_
vector< float > inputs_max_
vector< vector< float > * > wts_vec_
float * AllocWgt(int wgt_cnt)
static NeuralNet * FromFile(const string file_name)
bool FeedForward(const Type *inputs, Type *outputs)
bool FastFeedForward(const Type *inputs, Type *outputs)
bool ReadBinary(ReadBuffType *input_buff)
static const unsigned int kNetSignature
bool GetNetOutput(const Type *inputs, int output_id, Type *output)
vector< float > inputs_std_dev_
static const int kWgtChunkSize
bool SetConnection(int from, int to)
void set_node_type(NeuronTypes type)
vector< float > inputs_min_
bool FastGetNetOutput(const Type *inputs, int output_id, Type *output)