| 126 | // ---------------------------------------------------------------------------------------- |
| 127 | |
| 128 | matrix<double,0,1> solve_structural_svm_problem( |
| 129 | py::object problem |
| 130 | ) |
| 131 | { |
| 132 | // Check if the python code is using sparse or dense vectors to represent PSI() |
| 133 | if (py::isinstance<matrix<double,0,1>>(problem.attr("get_truth_joint_feature_vector")(0))) |
| 134 | return solve_structural_svm_problem_impl<matrix<double,0,1> >(problem); |
| 135 | else |
| 136 | return solve_structural_svm_problem_impl<std::vector<std::pair<unsigned long,double> > >(problem); |
| 137 | } |
| 138 | |
| 139 | // ---------------------------------------------------------------------------------------- |
| 140 | |