-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathneuton.h
125 lines (103 loc) · 2.75 KB
/
neuton.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#ifndef NEUTON_H
#define NEUTON_H
#include <stdint.h>
#include "model/model.h"
#ifdef __cplusplus
extern "C"
{
#endif
#if (NEUTON_MODEL_HEADER_VERSION < 3)
typedef float input_t;
#endif
///
/// \brief Get element count of array that you should pass to neuton_model_set_inputs() function
/// \return Array elements count
///
uint16_t neuton_model_inputs_count();
///
/// \brief Set input values
/// \param inputs - input_t[] array of neuton_model_inputs_count() elements
/// \return Zero if model ready for prediction. Result < 0 indicates error, result > 0 - model not ready for prediction.
///
int8_t neuton_model_set_inputs(input_t* inputs);
///
/// \brief Reset input values
///
void neuton_model_reset_inputs();
///
/// \brief Get element count of array that neuton_model_run_inference() returns
/// \return Array elements count
///
uint16_t neuton_model_outputs_count();
///
/// \brief Make a prediction
/// \param index - pointer to predicted class variable (binary/multi classification). Can be NULL.
/// \param outputs - float[] array of neuton_model_outputs_count() elements, contains predicted target variable
/// (for regression task) or probabilities of each class (binary/multi classification).
/// \return Zero on successful prediction. Result > 0 - model not ready for prediction.
///
int8_t neuton_model_run_inference(uint16_t* index, float** outputs);
///
/// \brief Task types
///
typedef enum
{
TASK_MULTICLASS_CLASSIFICATION = 0,
TASK_BINARY_CLASSIFICATION = 1,
TASK_REGRESSION = 2
}
TaskType;
///
/// \brief Get task type
/// \return Task type value
///
TaskType neuton_model_task_type();
///
/// \brief Get model quantization level
/// \return Quantization level (possible values: 8, 16, 32)
///
uint8_t neuton_model_quantization_level();
///
/// \brief Get float support flag
/// \return Flag value (possible values: 0, 1)
///
uint8_t neuton_model_float_calculations();
///
/// \brief Get model neurons count
/// \return Neurons count
///
uint16_t neuton_model_neurons_count();
///
/// \brief Get model weights count
/// \return Weights count
///
uint32_t neuton_model_weights_count();
///
/// \brief Get element count of input normalization array
/// \return Array elements count
///
uint16_t neuton_model_inputs_limits_count();
///
/// \brief Get window size
/// \return Window size
///
uint16_t neuton_model_window_size();
///
/// \brief Get model RAM usage
/// \return RAM usage in bytes
///
uint32_t neuton_model_ram_usage();
///
/// \brief Get model size
/// \return Model size without meta information
///
uint32_t neuton_model_size();
///
/// \brief Get model & meta information size
/// \return Model size with meta information
///
uint32_t neuton_model_size_with_meta();
#ifdef __cplusplus
}
#endif
#endif // NEUTON_H