diff --git a/tensorflow/lite/kernels/mul_test.cc b/tensorflow/lite/kernels/mul_test.cc index cd6abe04624..5efeb6b29b6 100644 --- a/tensorflow/lite/kernels/mul_test.cc +++ b/tensorflow/lite/kernels/mul_test.cc @@ -113,7 +113,7 @@ TEST(FloatMulOpTest, ActivationRELU_N1_TO_1) { } TEST(FloatMulOpTest, VariousInputShapes) { - std::vector> test_shapes = { + const std::vector> test_shapes = { {6}, {2, 3}, {2, 1, 3}, {1, 3, 1, 2}}; for (int i = 0; i < test_shapes.size(); ++i) { FloatMulOpModel m({TensorType_FLOAT32, test_shapes[i]}, @@ -130,7 +130,7 @@ TEST(FloatMulOpTest, VariousInputShapes) { } TEST(FloatMulOpTest, WithScalarBroadcast) { - std::vector> test_shapes = { + const std::vector> test_shapes = { {6}, {2, 3}, {2, 1, 3}, {1, 3, 1, 2}}; for (int i = 0; i < test_shapes.size(); ++i) { FloatMulOpModel m({TensorType_FLOAT32, test_shapes[i]}, @@ -147,7 +147,7 @@ TEST(FloatMulOpTest, WithScalarBroadcast) { } TEST(FloatMulOpTest, WithBroadcast) { - std::vector> test_shapes = { + const std::vector> test_shapes = { {2, 4}, {2, 1, 4}, {1, 2, 4}, {1, 2, 1, 4}}; for (int i = 0; i < test_shapes.size(); ++i) { FloatMulOpModel m({TensorType_FLOAT32, test_shapes[i]}, @@ -166,9 +166,9 @@ TEST(FloatMulOpTest, WithBroadcast) { TEST(FloatMulOpTest, MixedBroadcast) { const std::vector base_shape = {2, 3, 1, 2}; - std::vector> test_shapes = { + const std::vector> test_shapes = { {1, 1, 3, 2}, {1, 3, 1, 2}, {2, 1, 3, 1}, {2, 3, 1, 1}}; - std::vector> test_outputs = { + const std::vector> test_outputs = { {-0.06f, 0.69f, 0.12f, 1.15f, -0.30f, 2.07f, 0.18f, 0.15f, -0.36f, 0.25f, 0.90f, 0.45f, 0.16f, -0.33f, -0.32f, -0.55f, 0.80f, -0.99f, 0.24f, 0.84f, -0.48f, 1.40f, 1.20f, 2.52f, -0.32f, 0.00f, 0.64f, @@ -214,7 +214,7 @@ TEST(FloatMulOpTest, MixedBroadcast) { } TEST(FloatMulOpTest, WithBroadcast2Elements) { - std::vector> test_shapes = { + const std::vector> test_shapes = { {2, 2}, {2, 1, 2}, {1, 2, 2}, {1, 2, 1, 2}}; for (int i = 0; i < test_shapes.size(); ++i) { FloatMulOpModel m({TensorType_FLOAT32, test_shapes[i]}, @@ -250,7 +250,7 @@ TEST(IntegerMulOpTest, ActivationRELU_N1_TO_1) { } TEST(IntegerMulOpTest, VariousInputShapes) { - std::vector> test_shapes = { + const std::vector> test_shapes = { {6}, {2, 3}, {2, 1, 3}, {1, 3, 1, 2}}; for (int i = 0; i < test_shapes.size(); ++i) { IntegerMulOpModel m({TensorType_INT32, test_shapes[i]}, @@ -265,7 +265,7 @@ TEST(IntegerMulOpTest, VariousInputShapes) { } TEST(IntegerMulOpTest, WithBroadcast) { - std::vector> test_shapes = { + const std::vector> test_shapes = { {6}, {2, 3}, {2, 1, 3}, {1, 3, 1, 2}}; for (int i = 0; i < test_shapes.size(); ++i) { IntegerMulOpModel m({TensorType_INT32, test_shapes[i]}, @@ -392,12 +392,12 @@ float GetTolerance(int min, int max) { template void WithBroadcast() { - float kQuantizedTolerance = GetTolerance(-3.0, 3.0); - std::vector> test_shapes = { + const float kQuantizedTolerance = GetTolerance(-3.0, 3.0); + const std::vector> test_shapes = { {6}, {2, 3}, {2, 1, 3}, {1, 3, 1, 2}}; // Test with a smaller than 1 and greater than 1 quantization multiplier - std::vector> test_input_range = {{-3.0, 3.0}, - {-6.0, 6.0}}; + const std::vector> test_input_range = {{-3.0, 3.0}, + {-6.0, 6.0}}; for (int i = 0; i < test_shapes.size(); ++i) { for (int j = 0; j < test_input_range.size(); ++j) { const std::pair& input_range = test_input_range[j]; @@ -420,11 +420,11 @@ void WithBroadcast() { template void QuantizedWithMixedBroadcast() { - float kQuantizedTolerance = GetTolerance(-3.f, 3.f); + const float kQuantizedTolerance = GetTolerance(-3.f, 3.f); const std::vector base_shape = {2, 3, 1, 2}; - std::vector> test_shapes = { + const std::vector> test_shapes = { {1, 1, 3, 2}, {1, 3, 1, 2}, {2, 1, 3, 1}, {2, 3, 1, 1}}; - std::vector> test_outputs = { + const std::vector> test_outputs = { {-0.06f, 0.69f, 0.12f, 1.15f, -0.30f, 2.07f, 0.18f, 0.15f, -0.36f, 0.25f, 0.90f, 0.45f, 0.16f, -0.33f, -0.32f, -0.55f, 0.80f, -0.99f, 0.24f, 0.84f, -0.48f, 1.40f, 1.20f, 2.52f, -0.32f, 0.00f, 0.64f,