Skip to content

Commit 48939c1

Browse files
MozoLM Developerscopybara-github
authored andcommitted
No public description
PiperOrigin-RevId: 812450495
1 parent 6d333b0 commit 48939c1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

mozolm/models/simple_bigram_char_model.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ absl::Status ReadCountMatrix(const std::string& in_counts, int rows,
9494
} // namespace
9595

9696
absl::Status SimpleBigramCharModel::Read(const ModelStorage &storage) {
97-
absl::ReaderMutexLock nl(&normalizer_lock_);
98-
absl::ReaderMutexLock cl(&counts_lock_);
97+
absl::ReaderMutexLock nl(normalizer_lock_);
98+
absl::ReaderMutexLock cl(counts_lock_);
9999
const std::string &vocab_file = storage.vocabulary_file();
100100
const std::string &counts_file = storage.model_file();
101101
if (!vocab_file.empty()) {
@@ -161,8 +161,8 @@ int SimpleBigramCharModel::NextState(int state, int utf8_sym) {
161161
}
162162

163163
bool SimpleBigramCharModel::ExtractLMScores(int state, LMScores* response) {
164-
absl::ReaderMutexLock nl(&normalizer_lock_);
165-
absl::ReaderMutexLock cl(&counts_lock_);
164+
absl::ReaderMutexLock nl(normalizer_lock_);
165+
absl::ReaderMutexLock cl(counts_lock_);
166166
if (!ValidState(state)) {
167167
// Invalid state, switching to start state, by convention state 0.
168168
state = 0;
@@ -184,8 +184,8 @@ double SimpleBigramCharModel::SymLMScore(int state, int utf8_sym) {
184184
int sym_state = NextState(state, utf8_sym);
185185
double prob = 0.0;
186186
if (ValidState(state) && ValidState(sym_state)) {
187-
absl::ReaderMutexLock nl(&normalizer_lock_);
188-
absl::ReaderMutexLock cl(&counts_lock_);
187+
absl::ReaderMutexLock nl(normalizer_lock_);
188+
absl::ReaderMutexLock cl(counts_lock_);
189189
prob = static_cast<double>(bigram_counts_[state][sym_state]) /
190190
utf8_normalizer_[state];
191191
}
@@ -195,8 +195,8 @@ double SimpleBigramCharModel::SymLMScore(int state, int utf8_sym) {
195195
bool SimpleBigramCharModel::UpdateLMCounts(int state,
196196
const std::vector<int>& utf8_syms,
197197
int64_t count) {
198-
absl::WriterMutexLock nl(&normalizer_lock_);
199-
absl::WriterMutexLock cl(&counts_lock_);
198+
absl::WriterMutexLock nl(normalizer_lock_);
199+
absl::WriterMutexLock cl(counts_lock_);
200200
if (count <= 0) {
201201
// Returns true, nothing to update.
202202
return true;

0 commit comments

Comments
 (0)