20 static const float kMinInputRange = 1e-6f;
31 template <
typename Type>
bool FeedForward(
const Type *inputs,
36 template <
typename Type>
bool GetNetOutput(
const Type *inputs,
106 template<
class ReadBuffType>
bool ReadBinary(ReadBuffType *input_buff) {
110 unsigned int read_val;
111 unsigned int auto_encode;
113 if (input_buff->Read(&read_val,
sizeof(read_val)) !=
sizeof(read_val)) {
119 if (input_buff->Read(&auto_encode,
sizeof(auto_encode)) !=
120 sizeof(auto_encode)) {
125 if (input_buff->Read(&read_val,
sizeof(read_val)) !=
sizeof(read_val)) {
138 if (input_buff->Read(&read_val,
sizeof(read_val)) !=
sizeof(read_val)) {
146 if (input_buff->Read(&read_val,
sizeof(read_val)) !=
sizeof(read_val)) {
159 }
else if (idx >= (neuron_cnt_ -
out_cnt_)) {
166 for (
int node_idx = 0; node_idx <
neuron_cnt_; node_idx++) {
168 if (input_buff->Read(&read_val,
sizeof(read_val)) !=
sizeof(read_val)) {
172 int fan_out_cnt = read_val;
173 for (
int fan_out_idx = 0; fan_out_idx < fan_out_cnt; fan_out_idx++) {
175 if (input_buff->Read(&read_val,
sizeof(read_val)) !=
sizeof(read_val)) {
185 for (
int node_idx = 0; node_idx <
neuron_cnt_; node_idx++) {
246 #endif // NEURAL_NET_H__
static NeuralNet * FromInputBuffer(InputFileBuffer *ib)
static const int kWgtChunkSize
vector< float > inputs_min_
float * AllocWgt(int wgt_cnt)
bool ReadBinary(ReadBuffType *input_buff)
bool FastFeedForward(const Type *inputs, Type *outputs)
bool FastGetNetOutput(const Type *inputs, int output_id, Type *output)
bool GetNetOutput(const Type *inputs, int output_id, Type *output)
vector< float > inputs_mean_
bool FeedForward(const Type *inputs, Type *outputs)
vector< float > inputs_std_dev_
vector< Node > fast_nodes_
static const unsigned int kNetSignature
vector< float > inputs_max_
void set_node_type(NeuronTypes type)
vector< vector< float > * > wts_vec_
bool SetConnection(int from, int to)
static NeuralNet * FromFile(const string file_name)