Skip to content
Snippets Groups Projects

Fix segmentation fault when SVM is trained in sequenece. Fixes issue #9

Merged Tiago de Freitas Pereira requested to merge issue-9 into master
1 unresolved thread

This one is tricky. Although the tests are passing now (most of it), the solution is not appropriate.

I guess there is some reference counter that is decremented by mistake, but I was not able to find it. @andre.anjos look at the diff, I just created a fake iterator in the end of the training.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
679 if(self->cxx->getMachineType()==bob::learn::libsvm::machine_t::ONE_CLASS)
680 {
681 if (subtract && divide) machine = self->cxx->train(Xseq,*PyBlitzArrayCxx_AsBlitz<double,1>(subtract),*PyBlitzArrayCxx_AsBlitz<double,1>(divide));
682 else machine = self->cxx->train(Xseq);
683 }
684 else {
685 if (subtract && divide) machine = self->cxx->train(Xseq,*PyBlitzArrayCxx_AsBlitz<double,1>(subtract),*PyBlitzArrayCxx_AsBlitz<double,1>(divide));
686 else machine = self->cxx->train(Xseq);
687 }
674
675 if (subtract && divide) machine = self->cxx->train(Xseq,*PyBlitzArrayCxx_AsBlitz<double,1>(subtract),*PyBlitzArrayCxx_AsBlitz<double,1>(divide));
676 else machine = self->cxx->train(Xseq);
677
678 // Note: This is not a solution. I just want to see if it will work in all CI's
679 PyObject* iterator2 = PyObject_GetIter(X);
680
  • added 1 commit

    • f9ebc80d - removed decref of X in training

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Pavel KORSHUNOV changed title from WIP: Issue 9 to WIP: Fixes issue #9

    changed title from WIP: Issue 9 to WIP: Fixes issue #9

  • Interesting thing is that decref of X is done for PCA, e.g, here: https://gitlab.idiap.ch/bob/bob.learn.linear/blob/master/bob/learn/linear/pca.cpp#L201

    But there, X is first converted to Blitz array with PyBlitzArray_Converter, which, according to https://www.idiap.ch/software/bob/docs/latest/bob/bob.blitz/master/c_cpp_api.html#c.PyBlitzArray_Converter returns a new reference. So, in this case, auto X_ = make_safe(X); is a correct thing to do.

  • Amir MOHAMMADI unmarked as a Work In Progress

    unmarked as a Work In Progress

  • Amir MOHAMMADI changed title from WIP: Fixes issue #9 (closed) to Fix segmentation fault when SVM is trained in sequenece. Fixes issue #9 (closed)

    changed title from WIP: Fixes issue #9 (closed) to Fix segmentation fault when SVM is trained in sequenece. Fixes issue #9 (closed)

  • André Anjos enabled an automatic merge when the pipeline for fb9c89cf succeeds

    enabled an automatic merge when the pipeline for fb9c89cf succeeds

  • André Anjos mentioned in commit 2eea542f

    mentioned in commit 2eea542f

  • merged

  • Please register or sign in to reply
    Loading