Andy Maloney commited on
Commit
490ad62
·
unverified ·
1 Parent(s): be00889

whisper : use emplace_back in place of push_back (#319)

Browse files
Files changed (1) hide show
  1. whisper.cpp +2 -2
whisper.cpp CHANGED
@@ -1863,7 +1863,7 @@ static whisper_token_data whisper_sample_best(
1863
  probs_id.reserve(n_logits);
1864
 
1865
  for (int i = 0; i < n_logits; i++) {
1866
- probs_id.push_back(std::make_pair(probs[i], i));
1867
  }
1868
 
1869
  {
@@ -2434,7 +2434,7 @@ int whisper_lang_auto_detect(
2434
  std::vector<std::pair<float, int>> probs_id;
2435
  for (const auto & kv : g_lang) {
2436
  const auto token_lang = whisper_token_lang(ctx, kv.second.first);
2437
- probs_id.push_back({ ctx->probs[token_lang], kv.second.first });
2438
  }
2439
 
2440
  // sort descending
 
1863
  probs_id.reserve(n_logits);
1864
 
1865
  for (int i = 0; i < n_logits; i++) {
1866
+ probs_id.emplace_back(probs[i], i);
1867
  }
1868
 
1869
  {
 
2434
  std::vector<std::pair<float, int>> probs_id;
2435
  for (const auto & kv : g_lang) {
2436
  const auto token_lang = whisper_token_lang(ctx, kv.second.first);
2437
+ probs_id.emplace_back( ctx->probs[token_lang], kv.second.first );
2438
  }
2439
 
2440
  // sort descending