Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion egs/swbd/s5c/path.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export KALDI_ROOT=`pwd`/../../..
export PATH=$PWD/utils/:$KALDI_ROOT/src/bin:$KALDI_ROOT/tools/openfst/bin:$KALDI_ROOT/src/fstbin/:$KALDI_ROOT/src/gmmbin/:$KALDI_ROOT/src/featbin/:$KALDI_ROOT/src/lm/:$KALDI_ROOT/src/sgmmbin/:$KALDI_ROOT/src/sgmm2bin/:$KALDI_ROOT/src/fgmmbin/:$KALDI_ROOT/src/latbin/:$KALDI_ROOT/src/nnetbin:$KALDI_ROOT/src/nnet2bin:$KALDI_ROOT/src/nnet3bin:$KALDI_ROOT/src/online2bin/:$KALDI_ROOT/src/ivectorbin/:$KALDI_ROOT/src/lmbin/:$KALDI_ROOT/src/chainbin:$KALDI_ROOT/src/xvector:$KALDI_ROOT/src/xvectorbin:$KALDI_ROOT/src/kwsbin:$PWD:$PATH
export PATH=$PWD/utils/:$KALDI_ROOT/src/bin:$KALDI_ROOT/tools/openfst/bin:$KALDI_ROOT/src/fstbin/:$KALDI_ROOT/src/gmmbin/:$KALDI_ROOT/src/featbin/:$KALDI_ROOT/src/lm/:$KALDI_ROOT/src/sgmmbin/:$KALDI_ROOT/src/sgmm2bin/:$KALDI_ROOT/src/fgmmbin/:$KALDI_ROOT/src/latbin/:$KALDI_ROOT/src/nnetbin:$KALDI_ROOT/src/nnet2bin:$KALDI_ROOT/src/nnet3bin:$KALDI_ROOT/src/online2bin/:$KALDI_ROOT/src/ivectorbin/:$KALDI_ROOT/src/lmbin/:$KALDI_ROOT/src/chainbin:$KALDI_ROOT/src/xvectorbin:$KALDI_ROOT/src/kwsbin:$PWD:$PATH

export LC_ALL=C
8 changes: 4 additions & 4 deletions src/cudamatrix/cu-kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -2109,11 +2109,11 @@ static void _compute_xvector_objf(const Real* scores, MatrixDim scores_dim,
Real L = scores[scores_index];
if (i < scores_dim.cols && j < scores_dim.rows) {
if (i + 1 == j && i % 2 == 0) {
objf_terms[objf_index] = L < -15 ? -L : log(1.0 + exp(-L));
objf_derivs[derivs_index] = 1.0 / (1.0 + exp(L));
objf_terms[objf_index] = L < -15 ? L : -log(1.0 + exp(-L));
objf_derivs[derivs_index] = -1.0 / (1.0 + exp(L));
} else if (i < j) {
objf_terms[objf_index] = K * (L > 15 ? L : log(1.0 + exp(L)));
objf_derivs[derivs_index] = -K / (1.0 + exp(-L));
objf_terms[objf_index] = K * (L > 15 ? -L : -log(1.0 + exp(L)));
objf_derivs[derivs_index] = K / (1.0 + exp(-L));
} else {
objf_terms[objf_index] = 0.0;
objf_derivs[derivs_index] = 0.0;
Expand Down
8 changes: 4 additions & 4 deletions src/cudamatrix/cu-math.cc
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@ void ComputeXvectorObjfFromScores(const CuMatrixBase<BaseFloat> &scores,
for (int32 j = 0; j < num_rows; j++) {
BaseFloat L = scores(i, j);
if (i + 1 == j && i % 2 == 0) {
(*objf_terms)(i, j) = L < -15 ? -L : log(1.0 + exp(-L));
(*objf_derivs)(i, j) = 1.0 / (1.0 + exp(L));
(*objf_terms)(i, j) = L < -15 ? L : -log(1.0 + exp(-L));
(*objf_derivs)(i, j) = -1.0 / (1.0 + exp(L));
} else if (i < j) {
(*objf_terms)(i, j) = K * (L > 15 ? L : log(1.0 + exp(L)));
(*objf_derivs)(i, j) = -K / (1.0 + exp(-L));
(*objf_terms)(i, j) = K * (L > 15 ? -L : -log(1.0 + exp(L)));
(*objf_derivs)(i, j) = K / (1.0 + exp(-L));
} else {
(*objf_terms)(i, j) = 0;
(*objf_derivs)(i, j) = 0;
Expand Down
6 changes: 3 additions & 3 deletions src/xvector/xvector-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// See the Apache 2 License for the specific language governing permissions and
// limitations under the License.

#include "ivector/xvector.h"
#include "xvector/xvector.h"
#include "util/kaldi-io.h"
#include "cudamatrix/cu-matrix-lib.h"

Expand Down Expand Up @@ -228,7 +228,7 @@ void TestComputeXvectorObjfAndDeriv(
}
// Scale the same and different portions of the objective function
// so that both contribute a weight of N.
(*tot_objf) = same_objf + K * diff_objf;
(*tot_objf) = -same_objf - K * diff_objf;
(*tot_weight) = N;
}

Expand All @@ -245,7 +245,7 @@ void TestGetDeriv(const CuVector<BaseFloat> &v,
deriv_S->Resize(S_dim, kSetZero);

// This scalar is common to the different derivatives.
BaseFloat deriv_coef = d * Exp(-1 * d * similarity_score)
BaseFloat deriv_coef = -d * Exp(-1 * d * similarity_score)
/ (1 + Exp(-1 * d * similarity_score));

// Handle derivative with respect to v and w.
Expand Down