1 #include "BayesF16.h"
2 #include <stdio.h>
3 #include "Error.h"
4 #include "Test.h"
5 
6 
7 
test_gaussian_naive_bayes_predict_f16()8     void BayesF16::test_gaussian_naive_bayes_predict_f16()
9     {
10 
11        (void)arm_gaussian_naive_bayes_predict_f16(&bayes,
12                 inp,
13                 bufp,tempp);
14 
15     }
16 
17 
setUp(Testing::testID_t id,std::vector<Testing::param_t> & paramsArgs,Client::PatternMgr * mgr)18     void BayesF16::setUp(Testing::testID_t id,std::vector<Testing::param_t>& paramsArgs,Client::PatternMgr *mgr)
19     {
20 
21        std::vector<Testing::param_t>::iterator it = paramsArgs.begin();
22        this->vecDim = *it++;
23        this->classNb = *it++;
24 
25        switch(id)
26        {
27           case BayesF16::TEST_GAUSSIAN_NAIVE_BAYES_PREDICT_F16_1:
28           {
29 
30             int nbp,nbi;
31 
32             input.reload(BayesF16::INPUTS2_F16_ID,mgr);
33             params.reload(BayesF16::PARAMS2_F16_ID,mgr);
34             dims.reload(BayesF16::DIMS2_S16_ID,mgr);
35 
36             int16_t *dimsp=dims.ptr();
37 
38             nbi = dimsp[2*this->nb];
39             nbp = dimsp[2*this->nb + 1];
40 
41             const float16_t *paramsp = params.ptr() + nbp;
42 
43             this->theta=paramsp ;
44             this->sigma=paramsp + (this->classNb * this->vecDim);
45             this->classPrior=paramsp + 2*(this->classNb * this->vecDim);
46             this->epsilon=paramsp[this->classNb + 2*(this->classNb * this->vecDim)];
47             //printf("%f %f %f\n",this->theta[0],this->sigma[0],this->classPrior[0]);
48 
49             // Reference patterns are not loaded when we are in dump mode
50             predicts.reload(BayesF16::PREDICTS2_S16_ID,mgr);
51 
52             outputProbas.create(this->classNb,BayesF16::OUT_PROBA_F16_ID,mgr);
53             temp.create(this->classNb,BayesF16::OUT_PROBA_F16_ID,mgr);
54 
55             bayes.vectorDimension=this->vecDim;
56             bayes.numberOfClasses=this->classNb;
57             bayes.theta=this->theta;
58             bayes.sigma=this->sigma;
59             bayes.classPriors=this->classPrior;
60             bayes.epsilon=this->epsilon;
61 
62             this->inp = input.ptr() + nbi;
63 
64             this->bufp = outputProbas.ptr();
65             this->tempp = temp.ptr();
66 
67           }
68           break;
69 
70        }
71 
72 
73 
74     }
75 
tearDown(Testing::testID_t id,Client::PatternMgr * mgr)76     void BayesF16::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
77     {
78         (void)id;
79         (void)mgr;
80         this->nb++;
81     }
82