"git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "513fc6810481334067f75166a211c76ab1725921"
other.cpp 664 Bytes
Newer Older
Davis King's avatar
Davis King committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <boost/python.hpp>
#include <boost/shared_ptr.hpp>
#include <dlib/matrix.h>

using namespace dlib;
using namespace std;
using namespace boost::python;

tuple get_training_data()
{
    typedef matrix<double,0,1> sample_type;
    std::vector<sample_type> samples;
    std::vector<double> labels;

    sample_type samp(3);
16
17
18
19
20
21
22
23
24
25
26

    for (int i = 0; i < 10; ++i)
    {
        samp = 1,2,3;
        samples.push_back(samp);
        labels.push_back(+1);

        samp = -1,-2,-3;
        samples.push_back(samp);
        labels.push_back(-1);
    }
Davis King's avatar
Davis King committed
27
28
29
30
31
32
33
34
35

    return make_tuple(samples, labels);
}

void bind_other()
{
    def("get_training_data",get_training_data);
}