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

Function python_list_to_array

dlib/python/pybind_utils.h:35–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33
34 template <typename T,size_t N>
35 std::array<T,N> python_list_to_array (
36 const py::list& the_list
37 )
38 /*!
39 ensures
40 - converts a python object into a std::array<T,N> and returns it.
41 !*/
42 {
43 DLIB_CASSERT(len(the_list) == N, "Expected a list of " << N << " things.");
44 std::array<T,N> vect;
45 for (unsigned long i = 0; i < vect.size(); ++i)
46 {
47 vect[i] = the_list[i].cast<T>();
48 }
49 return vect;
50 }
51
52 template <typename T>
53 py::list vector_to_python_list (

Callers

nothing calls this directly

Calls 2

lenFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected