mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-23 19:13:00 +08:00
Remove unneeded test for nullptr
IntSimdMatrix::GetFastestMultiplier never returns a nullptr. Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
e2419b1968
commit
b73370aac9
@ -29,7 +29,7 @@ namespace tesseract {
|
||||
// available type for the current architecture.
|
||||
/* static */
|
||||
IntSimdMatrix* IntSimdMatrix::GetFastestMultiplier() {
|
||||
IntSimdMatrix* multiplier = nullptr;
|
||||
IntSimdMatrix* multiplier;
|
||||
if (SIMDDetect::IsAVX2Available()) {
|
||||
multiplier = new IntSimdMatrixAVX2();
|
||||
} else if (SIMDDetect::IsSSEAvailable()) {
|
||||
|
@ -987,11 +987,7 @@ void NetworkIO::ClipVector(int t, float range) {
|
||||
int NetworkIO::GetPadding(int num_features) {
|
||||
if (multiplier_ == nullptr)
|
||||
multiplier_ = IntSimdMatrix::GetFastestMultiplier();
|
||||
int pad = 0;
|
||||
if (multiplier_ != nullptr) {
|
||||
pad = multiplier_->RoundInputs(num_features) - num_features;
|
||||
}
|
||||
return pad;
|
||||
return multiplier_->RoundInputs(num_features) - num_features;
|
||||
}
|
||||
|
||||
} // namespace tesseract.
|
||||
|
@ -169,7 +169,7 @@ void WeightMatrix::ConvertToInt() {
|
||||
wf_.Resize(1, 1, 0.0);
|
||||
int_mode_ = true;
|
||||
multiplier_.reset(IntSimdMatrix::GetFastestMultiplier());
|
||||
if (multiplier_ != nullptr) multiplier_->Init(wi_);
|
||||
multiplier_->Init(wi_);
|
||||
}
|
||||
|
||||
// Allocates any needed memory for running Backward, and zeroes the deltas,
|
||||
@ -222,7 +222,7 @@ bool WeightMatrix::DeSerialize(bool training, TFile* fp) {
|
||||
if (!wi_.DeSerialize(fp)) return false;
|
||||
if (!scales_.DeSerialize(fp)) return false;
|
||||
multiplier_.reset(IntSimdMatrix::GetFastestMultiplier());
|
||||
if (multiplier_ != nullptr) multiplier_->Init(wi_);
|
||||
multiplier_->Init(wi_);
|
||||
} else {
|
||||
if (!wf_.DeSerialize(fp)) return false;
|
||||
if (training) {
|
||||
|
Loading…
Reference in New Issue
Block a user