mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-24 03:23:04 +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.
|
// available type for the current architecture.
|
||||||
/* static */
|
/* static */
|
||||||
IntSimdMatrix* IntSimdMatrix::GetFastestMultiplier() {
|
IntSimdMatrix* IntSimdMatrix::GetFastestMultiplier() {
|
||||||
IntSimdMatrix* multiplier = nullptr;
|
IntSimdMatrix* multiplier;
|
||||||
if (SIMDDetect::IsAVX2Available()) {
|
if (SIMDDetect::IsAVX2Available()) {
|
||||||
multiplier = new IntSimdMatrixAVX2();
|
multiplier = new IntSimdMatrixAVX2();
|
||||||
} else if (SIMDDetect::IsSSEAvailable()) {
|
} else if (SIMDDetect::IsSSEAvailable()) {
|
||||||
|
@ -987,11 +987,7 @@ void NetworkIO::ClipVector(int t, float range) {
|
|||||||
int NetworkIO::GetPadding(int num_features) {
|
int NetworkIO::GetPadding(int num_features) {
|
||||||
if (multiplier_ == nullptr)
|
if (multiplier_ == nullptr)
|
||||||
multiplier_ = IntSimdMatrix::GetFastestMultiplier();
|
multiplier_ = IntSimdMatrix::GetFastestMultiplier();
|
||||||
int pad = 0;
|
return multiplier_->RoundInputs(num_features) - num_features;
|
||||||
if (multiplier_ != nullptr) {
|
|
||||||
pad = multiplier_->RoundInputs(num_features) - num_features;
|
|
||||||
}
|
|
||||||
return pad;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace tesseract.
|
} // namespace tesseract.
|
||||||
|
@ -169,7 +169,7 @@ void WeightMatrix::ConvertToInt() {
|
|||||||
wf_.Resize(1, 1, 0.0);
|
wf_.Resize(1, 1, 0.0);
|
||||||
int_mode_ = true;
|
int_mode_ = true;
|
||||||
multiplier_.reset(IntSimdMatrix::GetFastestMultiplier());
|
multiplier_.reset(IntSimdMatrix::GetFastestMultiplier());
|
||||||
if (multiplier_ != nullptr) multiplier_->Init(wi_);
|
multiplier_->Init(wi_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocates any needed memory for running Backward, and zeroes the deltas,
|
// 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 (!wi_.DeSerialize(fp)) return false;
|
||||||
if (!scales_.DeSerialize(fp)) return false;
|
if (!scales_.DeSerialize(fp)) return false;
|
||||||
multiplier_.reset(IntSimdMatrix::GetFastestMultiplier());
|
multiplier_.reset(IntSimdMatrix::GetFastestMultiplier());
|
||||||
if (multiplier_ != nullptr) multiplier_->Init(wi_);
|
multiplier_->Init(wi_);
|
||||||
} else {
|
} else {
|
||||||
if (!wf_.DeSerialize(fp)) return false;
|
if (!wf_.DeSerialize(fp)) return false;
|
||||||
if (training) {
|
if (training) {
|
||||||
|
Loading…
Reference in New Issue
Block a user