Skip to content

Commit d27a416

Browse files
committed
Merge branch 'stable_forced_align' into forced_align_backptr
2 parents 75d246a + ced6124 commit d27a416

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libtorchaudio/forced_align/cpu/compute.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void forced_align_impl(
2727
const auto L = targets.size(1);
2828
const auto S = 2 * L + 1;
2929

30-
auto alphas_a = new scalar_t[S][2];
30+
auto alphas_a = new scalar_t[S][2]; // scalar_t is just logProbs.dtype()
3131
for (int i = 0; i < S; i++) {
3232
alphas_a[i][0] = kNegInfinity;
3333
alphas_a[i][1] = kNegInfinity;
@@ -122,6 +122,7 @@ void forced_align_impl(
122122
}
123123
auto idx1 = (T - 1) % 2;
124124
auto ltrIdx = alphas_a[S - 1][idx1] > alphas_a[S - 2][idx1] ? S - 1 : S - 2;
125+
delete[] alphas_a;
125126
// path stores the token index for each time step after force alignment.
126127
for (auto t = T - 1; t > -1; t--) {
127128
auto lbl_idx = ltrIdx % 2 == 0 ? blank : targets_a[batchIndex][ltrIdx / 2];

0 commit comments

Comments
 (0)