3 #include <fwk/CentralConfig.h>
4 #include <utl/ErrorLogger.h>
5 #include <utl/Reader.h>
10 #include <pybind11/embed.h>
11 #include <pybind11/eigen.h>
19 using Mat = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>;
22 namespace MyPyModuleNS {
27 INFO(
"Loading XML-config");
35 INFO(
"Initialize the python interpreter.");
36 pybind11::initialize_interpreter();
38 INFO(
"Initialize main module and main class.");
39 fModule = pybind11::module_::import(fFilename.c_str());
40 fMainClass = fModule.attr(
"Dog")();
50 typedef Eigen::Matrix<float, 10, 10> M;
55 fMainClass.attr(
"bark")(
"It works!");
56 fMainClass.attr(
"woof")();
58 pybind11::tuple args = pybind11::make_tuple(m1,
m2);
59 pybind11::object result_py = fMainClass.attr(
"fetch_neural_network_result")(args);
61 const auto result = result_py.cast<
Mat>();
63 cout <<
"result has the values " <<
result <<
"\n"
64 "result is of size " <<
result.rows() <<
'x' <<
result.cols() << std::endl;
76 INFO(
"Finalize the python interpreter.");
84 pybind11::finalize_interpreter();
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > Mat
#define INFO(message)
Macro for logging informational messages.
void Init()
Initialise the registry.
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Class representing a document branch.
void GetData(bool &b) const
Overloads of the GetData member template function.
ResultFlag
Flag returned by module methods to the RunController.
Main configuration utility.
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)