add blank_penalty for offline transducer (#542)
This commit is contained in:
@@ -96,6 +96,15 @@ void LogSoftmax(T *in, int32_t w, int32_t h) {
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void SubtractBlank(T *in, int32_t w, int32_t h,
|
||||
int32_t blank_idx, float blank_penalty) {
|
||||
for (int32_t i = 0; i != h; ++i) {
|
||||
in[blank_idx] -= blank_penalty;
|
||||
in += w;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
std::vector<int32_t> TopkIndex(const T *vec, int32_t size, int32_t topk) {
|
||||
std::vector<int32_t> vec_index(size);
|
||||
|
||||
Reference in New Issue
Block a user