diff --git a/bob/learn/em/empca_trainer.cpp b/bob/learn/em/empca_trainer.cpp index dae075f90e99c0141780d1e90b617600ef4af6aa..70cbe2037f8adc051c8db0202dd8da6e352bbe53 100644 --- a/bob/learn/em/empca_trainer.cpp +++ b/bob/learn/em/empca_trainer.cpp @@ -166,7 +166,7 @@ static auto initialize = bob::extension::FunctionDoc( "", true ) -.add_prototype("linear_machine,data") +.add_prototype("linear_machine, data, [rng]") .add_parameter("linear_machine", ":py:class:`bob.learn.linear.Machine`", "LinearMachine Object") .add_parameter("data", "array_like <float, 2D>", "Input data") .add_parameter("rng", ":py:class:`bob.core.random.mt19937`", "The Mersenne Twister mt19937 random generator used for the initialization of subspaces/arrays before the EM loop."); @@ -186,8 +186,7 @@ static PyObject* PyBobLearnEMEMPCATrainer_initialize(PyBobLearnEMEMPCATrainerObj auto data_ = make_safe(data); if(rng){ - boost::shared_ptr<boost::mt19937> rng_cpy = (boost::shared_ptr<boost::mt19937>)new boost::mt19937(*rng->rng); - self->cxx->setRng(rng_cpy); + self->cxx->setRng(rng->rng); } diff --git a/bob/learn/em/isv_trainer.cpp b/bob/learn/em/isv_trainer.cpp index 11a241a61403fc762f1283ae6332a61bcc0f4474..02f453bbbc1715bdc2375d4c42aa36ee8f7836b0 100644 --- a/bob/learn/em/isv_trainer.cpp +++ b/bob/learn/em/isv_trainer.cpp @@ -409,7 +409,7 @@ static auto initialize = bob::extension::FunctionDoc( "", true ) -.add_prototype("isv_base, stats, rng") +.add_prototype("isv_base, stats, [rng]") .add_parameter("isv_base", ":py:class:`bob.learn.em.ISVBase`", "ISVBase Object") .add_parameter("stats", ":py:class:`bob.learn.em.GMMStats`", "GMMStats Object") .add_parameter("rng", ":py:class:`bob.core.random.mt19937`", "The Mersenne Twister mt19937 random generator used for the initialization of subspaces/arrays before the EM loop."); @@ -428,8 +428,7 @@ static PyObject* PyBobLearnEMISVTrainer_initialize(PyBobLearnEMISVTrainerObject* &PyBoostMt19937_Type, &rng)) return 0; if(rng){ - boost::shared_ptr<boost::mt19937> rng_cpy = (boost::shared_ptr<boost::mt19937>)new boost::mt19937(*rng->rng); - self->cxx->setRng(rng_cpy); + self->cxx->setRng(rng->rng); } std::vector<std::vector<boost::shared_ptr<bob::learn::em::GMMStats> > > training_data; diff --git a/bob/learn/em/ivector_trainer.cpp b/bob/learn/em/ivector_trainer.cpp index 876fe30672f52b1a0666483ff5e7577a59c5748e..33193af77d2eb791cc152c00a3ae99996d2b3c1d 100644 --- a/bob/learn/em/ivector_trainer.cpp +++ b/bob/learn/em/ivector_trainer.cpp @@ -332,8 +332,7 @@ static PyObject* PyBobLearnEMIVectorTrainer_initialize(PyBobLearnEMIVectorTraine &PyBoostMt19937_Type, &rng)) return 0; if(rng){ - boost::shared_ptr<boost::mt19937> rng_cpy = (boost::shared_ptr<boost::mt19937>)new boost::mt19937(*rng->rng); - self->cxx->setRng(rng_cpy); + self->cxx->setRng(rng->rng); } self->cxx->initialize(*ivector_machine->cxx); diff --git a/bob/learn/em/jfa_trainer.cpp b/bob/learn/em/jfa_trainer.cpp index 0fccf38c0a8dbb5f9b4f8f26cf92072b8d1fd0ec..d8ed5d78d9151b8f0eaf6c9d382d781a2bb7f111 100644 --- a/bob/learn/em/jfa_trainer.cpp +++ b/bob/learn/em/jfa_trainer.cpp @@ -620,7 +620,7 @@ static auto initialize = bob::extension::FunctionDoc( "", true ) -.add_prototype("jfa_base,stats,rng") +.add_prototype("jfa_base, stats, [rng]") .add_parameter("jfa_base", ":py:class:`bob.learn.em.JFABase`", "JFABase Object") .add_parameter("stats", ":py:class:`bob.learn.em.GMMStats`", "GMMStats Object") .add_parameter("rng", ":py:class:`bob.core.random.mt19937`", "The Mersenne Twister mt19937 random generator used for the initialization of subspaces/arrays before the EM loop."); @@ -639,8 +639,7 @@ static PyObject* PyBobLearnEMJFATrainer_initialize(PyBobLearnEMJFATrainerObject* &PyBoostMt19937_Type, &rng)) return 0; if(rng){ - boost::shared_ptr<boost::mt19937> rng_cpy = (boost::shared_ptr<boost::mt19937>)new boost::mt19937(*rng->rng); - self->cxx->setRng(rng_cpy); + self->cxx->setRng(rng->rng); } std::vector<std::vector<boost::shared_ptr<bob::learn::em::GMMStats> > > training_data; diff --git a/bob/learn/em/kmeans_trainer.cpp b/bob/learn/em/kmeans_trainer.cpp index 82be851f0fab628ad28725a022ebea647dc89fa6..1fb0a282c8847a0ab5b803ec6d5d785ffc2a156b 100644 --- a/bob/learn/em/kmeans_trainer.cpp +++ b/bob/learn/em/kmeans_trainer.cpp @@ -313,7 +313,7 @@ static auto initialize = bob::extension::FunctionDoc( "Data is split into as many chunks as there are means, then each mean is set to a random example within each chunk.", true ) -.add_prototype("kmeans_machine,data, rng") +.add_prototype("kmeans_machine, data, [rng]") .add_parameter("kmeans_machine", ":py:class:`bob.learn.em.KMeansMachine`", "KMeansMachine Object") .add_parameter("data", "array_like <float, 2D>", "Input data") .add_parameter("rng", ":py:class:`bob.core.random.mt19937`", "The Mersenne Twister mt19937 random generator used for the initialization of subspaces/arrays before the EM loop."); @@ -349,8 +349,7 @@ static PyObject* PyBobLearnEMKMeansTrainer_initialize(PyBobLearnEMKMeansTrainerO } if(rng){ - boost::shared_ptr<boost::mt19937> rng_cpy = (boost::shared_ptr<boost::mt19937>)new boost::mt19937(*rng->rng); - self->cxx->setRng(rng_cpy); + self->cxx->setRng(rng->rng); } self->cxx->initialize(*kmeans_machine->cxx, *PyBlitzArrayCxx_AsBlitz<double,2>(data)); diff --git a/bob/learn/em/plda_trainer.cpp b/bob/learn/em/plda_trainer.cpp index 4cd143830a6ef1f3e7b1f745ba57bb0d9beb6e07..849db8454e72cc078f23301fa544aa420c9a70a1 100644 --- a/bob/learn/em/plda_trainer.cpp +++ b/bob/learn/em/plda_trainer.cpp @@ -424,7 +424,7 @@ static auto initialize = bob::extension::FunctionDoc( "", true ) -.add_prototype("plda_base,data,rng") +.add_prototype("plda_base, data, [rng]") .add_parameter("plda_base", ":py:class:`bob.learn.em.PLDABase`", "PLDAMachine Object") .add_parameter("data", "list", "") .add_parameter("rng", ":py:class:`bob.core.random.mt19937`", "The Mersenne Twister mt19937 random generator used for the initialization of subspaces/arrays before the EM loop."); @@ -445,8 +445,7 @@ static PyObject* PyBobLearnEMPLDATrainer_initialize(PyBobLearnEMPLDATrainerObjec std::vector<blitz::Array<double,2> > data_vector; if(list_as_vector(data ,data_vector)==0){ if(rng){ - boost::shared_ptr<boost::mt19937> rng_cpy = (boost::shared_ptr<boost::mt19937>)new boost::mt19937(*rng->rng); - self->cxx->setRng(rng_cpy); + self->cxx->setRng(rng->rng); } self->cxx->initialize(*plda_base->cxx, data_vector); diff --git a/requirements.txt b/requirements.txt index bfc83b56e0524e4d0329a30ea070221113865d60..de7c30c6b79b741b62f89e22bca754ec0284c856 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ setuptools bob.extension bob.blitz -bob.core +bob.core>2.0.5 bob.io.base bob.sp bob.math