Skip to content

Commit 75d246a

Browse files
committed
Add comment about original indexing
1 parent e70113c commit 75d246a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/libtorchaudio/forced_align/cpu/compute.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void forced_align_impl(
8787
if (start == 0) {
8888
alphas_a[0][curIdxOffset] =
8989
alphas_a[0][prevIdxOffset] + logProbs_a[batchIndex][t][blank];
90-
backPtr_a[S * t] = 0;
90+
backPtr_a[S * t] = 0; // backPtr_a[t][0] = 0
9191
startloop += 1;
9292
}
9393

@@ -109,13 +109,13 @@ void forced_align_impl(
109109
scalar_t result = 0.0;
110110
if (x2 > x1 && x2 > x0) {
111111
result = x2;
112-
backPtr_a[t * S + i] = 2;
112+
backPtr_a[t * S + i] = 2; // backPtr_a[t][i] = 2
113113
} else if (x1 > x0 && x1 > x2) {
114114
result = x1;
115-
backPtr_a[t * S + i] = 1;
115+
backPtr_a[t * S + i] = 1; // backPtr_a[t][i] = 1
116116
} else {
117117
result = x0;
118-
backPtr_a[t * S + i] = 0;
118+
backPtr_a[t * S + i] = 0; // backPtr_a[t][i] = 0
119119
}
120120
alphas_a[i][curIdxOffset] = result + logProbs_a[batchIndex][t][labelIdx];
121121
}
@@ -126,7 +126,7 @@ void forced_align_impl(
126126
for (auto t = T - 1; t > -1; t--) {
127127
auto lbl_idx = ltrIdx % 2 == 0 ? blank : targets_a[batchIndex][ltrIdx / 2];
128128
paths_a[batchIndex][t] = lbl_idx;
129-
ltrIdx -= backPtr_a[t * S + ltrIdx];
129+
ltrIdx -= backPtr_a[t * S + ltrIdx]; // backPtr_a[t][ltrIdx]
130130
}
131131
}
132132

0 commit comments

Comments
 (0)