18#include <gtest/gtest.h>
19#include <gtest/internal/gtest-port.h>
32 std::locale::global(std::locale(
""));
38 for (
int i = 0; i < no; ++i) {
39 for (
int j = 0; j < ni; ++j) {
48 std::vector<int8_t> v(rounded_size, 0);
49 for (
int i = 0; i < size; ++i) {
56 std::vector<TFloat> v(size);
57 for (
int i = 0; i < size; ++i) {
65 for (
int num_out = 1; num_out < 130; ++num_out) {
66 for (
int num_in = 1; num_in < 130; ++num_in) {
74 std::vector<TFloat> base_result(num_out);
76 std::vector<TFloat> test_result(ro);
77 std::vector<int8_t> shaped_wi;
78 int32_t rounded_num_out;
79 matrix.
Init(w, shaped_wi, rounded_num_out);
80 scales.resize(rounded_num_out);
87 for (
int i = 0; i < num_out; ++i) {
88 EXPECT_FLOAT_EQ(base_result[i], test_result[i]) <<
"i=" << i;
89 total += base_result[i];
95 EXPECT_FLOAT_EQ(total, 337852.16f);
97 EXPECT_FLOAT_EQ(total, 337849.39354684710);
107 ExpectEqualResults(matrix);
112#if defined(HAVE_SSE4_1)
114 GTEST_LOG_(
INFO) <<
"No SSE found! Not tested!";
119 GTEST_LOG_(
INFO) <<
"SSE unsupported! Not tested!";
126#if defined(HAVE_AVX2)
128 GTEST_LOG_(
INFO) <<
"No AVX2 found! Not tested!";
133 GTEST_LOG_(
INFO) <<
"AVX2 unsupported! Not tested!";
TEST_F(EuroText, FastLatinOCR)
static const IntSimdMatrix intSimdMatrixAVX2
int RoundOutputs(int size) const
static void MatrixDotVector(const GENERIC_2D_ARRAY< int8_t > &w, const std::vector< TFloat > &scales, const int8_t *u, TFloat *v)
int RoundInputs(int size) const
MatrixDotVectorFunction matrixDotVectorFunction
static const IntSimdMatrix * intSimdMatrix
static const IntSimdMatrix intSimdMatrixSSE
void Init(const GENERIC_2D_ARRAY< int8_t > &w, std::vector< int8_t > &shaped_w, int32_t &rounded_num_out) const
static bool IsSSEAvailable()
static bool IsAVX2Available()
double SignedRand(double range)
std::vector< int8_t > RandomVector(int size, const IntSimdMatrix &matrix)
std::vector< TFloat > RandomScales(int size)
void ExpectEqualResults(const IntSimdMatrix &matrix)
GENERIC_2D_ARRAY< int8_t > InitRandom(int no, int ni)