Skip to content

Commit edafa1d

Browse files
authored
Fix get_decision_function (#645)
1 parent 0bed689 commit edafa1d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

onedal/svm/backend/svm_py.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,10 @@ PyObject *svm_infer<Task>::get_labels() {
286286
// attributes from infer_result
287287
template <typename Task>
288288
PyObject *svm_infer<Task>::get_decision_function() {
289-
return convert_to_numpy(infer_result_.get_decision_function());
289+
if constexpr (std::is_same_v<Task, svm::task::classification>) {
290+
return convert_to_numpy(infer_result_.get_decision_function());
291+
}
292+
return nullptr;
290293
}
291294

292295
template class ONEDAL_BACKEND_EXPORT svm_model<svm::task::classification>;

0 commit comments

Comments
 (0)