Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.learn.em
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.learn.em
Commits
1eab675d
Commit
1eab675d
authored
10 years ago
by
Manuel Günther
Browse files
Options
Downloads
Patches
Plain Diff
Added rng to IvectorTrainer initialize method
parent
7dbafb34
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/learn/em/include/bob.learn.em/IVectorTrainer.h
+6
-2
6 additions, 2 deletions
bob/learn/em/include/bob.learn.em/IVectorTrainer.h
bob/learn/em/ivector_trainer.cpp
+13
-6
13 additions, 6 deletions
bob/learn/em/ivector_trainer.cpp
with
19 additions
and
8 deletions
bob/learn/em/include/bob.learn.em/IVectorTrainer.h
+
6
−
2
View file @
1eab675d
...
...
@@ -121,6 +121,10 @@ class IVectorTrainer
{
bob
::
core
::
array
::
assertSameShape
(
acc
,
m_acc_Snormij
);
m_acc_Snormij
=
acc
;
}
void
setRng
(
boost
::
shared_ptr
<
boost
::
mt19937
>
rng
){
m_rng
=
rng
;
};
protected
:
// Attributes
bool
m_update_sigma
;
...
...
@@ -140,11 +144,11 @@ class IVectorTrainer
mutable
blitz
::
Array
<
double
,
2
>
m_tmp_dt1
;
mutable
blitz
::
Array
<
double
,
2
>
m_tmp_tt1
;
mutable
blitz
::
Array
<
double
,
2
>
m_tmp_tt2
;
/**
* @brief The random number generator for the inialization
*/
boost
::
shared_ptr
<
boost
::
mt19937
>
m_rng
;
boost
::
shared_ptr
<
boost
::
mt19937
>
m_rng
;
};
}
}
}
// namespaces
...
...
This diff is collapsed.
Click to expand it.
bob/learn/em/ivector_trainer.cpp
+
13
−
6
View file @
1eab675d
...
...
@@ -313,9 +313,10 @@ static auto initialize = bob::extension::FunctionDoc(
""
,
true
)
.
add_prototype
(
"ivector_machine, stats"
)
.
add_parameter
(
"ivector_machine"
,
":py:class:`bob.learn.em.ISVBase`"
,
"IVectorMachine Object"
)
.
add_parameter
(
"stats"
,
":py:class:`bob.learn.em.GMMStats`"
,
"Ignored"
);
.
add_prototype
(
"ivector_machine, [stats], [rng]"
)
.
add_parameter
(
"ivector_machine"
,
":py:class:`bob.learn.em.IVectorMachine`"
,
"IVectorMachine Object"
)
.
add_parameter
(
"stats"
,
":py:class:`bob.learn.em.GMMStats`"
,
"Ignored"
)
.
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."
);
static
PyObject
*
PyBobLearnEMIVectorTrainer_initialize
(
PyBobLearnEMIVectorTrainerObject
*
self
,
PyObject
*
args
,
PyObject
*
kwargs
)
{
BOB_TRY
...
...
@@ -324,9 +325,15 @@ static PyObject* PyBobLearnEMIVectorTrainer_initialize(PyBobLearnEMIVectorTraine
PyBobLearnEMIVectorMachineObject
*
ivector_machine
=
0
;
PyObject
*
stats
=
0
;
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"O!|O!"
,
kwlist
,
&
PyBobLearnEMIVectorMachine_Type
,
&
ivector_machine
,
&
PyList_Type
,
&
stats
))
return
0
;
PyBoostMt19937Object
*
rng
=
0
;
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"O!|O!O!"
,
kwlist
,
&
PyBobLearnEMIVectorMachine_Type
,
&
ivector_machine
,
&
PyList_Type
,
&
stats
,
&
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
->
initialize
(
*
ivector_machine
->
cxx
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment