MCPcopy Create free account
hub / github.com/davisking/dlib / np_to_cpp

Function np_to_cpp

tools/python/src/decision_functions.cpp:18–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16typedef std::vector<std::pair<unsigned long,double> > sparse_vect;
17
18void np_to_cpp (
19 const numpy_image<double>& x_,
20 std::vector<matrix<double,0,1>>& samples
21)
22{
23 auto x = make_image_view(x_);
24 DLIB_CASSERT(x.nc() > 0);
25 DLIB_CASSERT(x.nr() > 0);
26 samples.resize(x.nr());
27 for (long r = 0; r < x.nr(); ++r)
28 {
29 samples[r].set_size(x.nc());
30 for (long c = 0; c < x.nc(); ++c)
31 {
32 samples[r](c) = x[r][c];
33 }
34 }
35}
36
37void np_to_cpp (
38 const numpy_image<double>& x_,

Calls 9

make_image_viewFunction · 0.85
ncMethod · 0.45
nrMethod · 0.45
resizeMethod · 0.45
set_sizeMethod · 0.45
ndimMethod · 0.45
sizeMethod · 0.45
assignMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected