Commit 5643c20a authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

Ignore the rng variable in the bindings

parent dce267f6
Pipeline #11985 passed with stages
in 22 minutes and 49 seconds
......@@ -306,9 +306,10 @@ static auto initialize = bob::extension::FunctionDoc(
"",
true
)
.add_prototype("gmm_machine, [data]")
.add_prototype("gmm_machine, [data], [rng]")
.add_parameter("gmm_machine", ":py:class:`bob.learn.em.GMMMachine`", "GMMMachine Object")
.add_parameter("data", "object", "Ignored.");
.add_parameter("data", "object", "Ignored.")
.add_parameter("rng", "object", "Ignored.");
static PyObject* PyBobLearnEMMAPGMMTrainer_initialize(PyBobLearnEMMAPGMMTrainerObject* self, PyObject* args, PyObject* kwargs) {
BOB_TRY
......@@ -317,9 +318,10 @@ static PyObject* PyBobLearnEMMAPGMMTrainer_initialize(PyBobLearnEMMAPGMMTrainerO
PyBobLearnEMGMMMachineObject* gmm_machine = 0;
PyObject* data;
PyBoostMt19937Object* rng = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!|O", kwlist, &PyBobLearnEMGMMMachine_Type, &gmm_machine,
&data)) return 0;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!|OO!", kwlist, &PyBobLearnEMGMMMachine_Type, &gmm_machine,
&data, &PyBoostMt19937_Type, &rng)) return 0;
self->cxx->initialize(*gmm_machine->cxx);
......
......@@ -192,9 +192,10 @@ static auto initialize = bob::extension::FunctionDoc(
"",
true
)
.add_prototype("gmm_machine, [data]")
.add_prototype("gmm_machine, [data], [rng]")
.add_parameter("gmm_machine", ":py:class:`bob.learn.em.GMMMachine`", "GMMMachine Object")
.add_parameter("data", "object", "Ignored.");
.add_parameter("data", "object", "Ignored.")
.add_parameter("rng", "object", "Ignored.");
static PyObject* PyBobLearnEMMLGMMTrainer_initialize(PyBobLearnEMMLGMMTrainerObject* self, PyObject* args, PyObject* kwargs) {
BOB_TRY
......@@ -202,9 +203,10 @@ static PyObject* PyBobLearnEMMLGMMTrainer_initialize(PyBobLearnEMMLGMMTrainerObj
char** kwlist = initialize.kwlist(0);
PyBobLearnEMGMMMachineObject* gmm_machine = 0;
PyObject* data;
PyBoostMt19937Object* rng = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!|O", kwlist, &PyBobLearnEMGMMMachine_Type, &gmm_machine,
&data)) return 0;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!|OO!", kwlist, &PyBobLearnEMGMMMachine_Type, &gmm_machine,
&data, &PyBoostMt19937_Type, &rng)) return 0;
self->cxx->initialize(*gmm_machine->cxx);
BOB_CATCH_MEMBER("cannot perform the initialize method", 0)
......
......@@ -45,9 +45,7 @@ def train(trainer, machine, data, max_iterations=50, convergence_threshold=None,
# Initialization
if initialize:
if rng is not None and \
(not isinstance(trainer, (bob.learn.em.ML_GMMTrainer,
bob.learn.em.MAP_GMMTrainer))):
if rng is not None:
trainer.initialize(machine, data, rng)
else:
trainer.initialize(machine, data)
......
2.0.14b0
\ No newline at end of file
2.1.0b0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment