diff --git a/tensorflow/lite/micro/kernels/zeros_like.cc b/tensorflow/lite/micro/kernels/zeros_like.cc index 752745bcf83..1b986cc1695 100644 --- a/tensorflow/lite/micro/kernels/zeros_like.cc +++ b/tensorflow/lite/micro/kernels/zeros_like.cc @@ -38,7 +38,7 @@ TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { } template -void resetZeros(T* out, int num_elements) { +void resetZeros(T* out, const int num_elements) { for (int i = 0; i < num_elements; ++i) { out[i] = static_cast(0); } diff --git a/tensorflow/lite/micro/kernels/zeros_like_test.cc b/tensorflow/lite/micro/kernels/zeros_like_test.cc index 5e1a326c268..70b35f6771d 100644 --- a/tensorflow/lite/micro/kernels/zeros_like_test.cc +++ b/tensorflow/lite/micro/kernels/zeros_like_test.cc @@ -13,6 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ +#include #include "tensorflow/lite/c/builtin_op_data.h" #include "tensorflow/lite/c/common.h" #include "tensorflow/lite/micro/all_ops_resolver.h" @@ -51,6 +52,7 @@ void TestZerosLikeFloat(const int* input_dims_data, const float* input_data, TF_LITE_MICRO_EXPECT_EQ(kTfLiteOk, runner.InitAndPrepare()); TF_LITE_MICRO_EXPECT_EQ(kTfLiteOk, runner.Invoke()); + micro_test::reporter->Report("output_dims_count: %d", output_dims_count); for (int i = 0; i < output_dims_count; ++i) { TF_LITE_MICRO_EXPECT_EQ(expected_output_data[i], output_data[i]); } @@ -128,25 +130,29 @@ TF_LITE_MICRO_TESTS_BEGIN TF_LITE_MICRO_TEST(TestZerosLikeFloat) { float output_data[6]; - const int input_dims[] = {2, 3}; + const int input_dims[] = {1, 2, 3}; const float input_values[] = {-2.0, -1.0, 0.0, 1.0, 2.0, 3.0}; - const float golden[] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; + + // HOW DID THIS PASS ?! + const float golden[] = {0.0, 0.0, 0.0, 125.0, 0.0, 0.0}; tflite::testing::TestZerosLikeFloat(input_dims, input_values, golden, output_data); } TF_LITE_MICRO_TEST(TestZerosLikeInt32) { int32_t output_data[4]; - const int input_dims[] = {1, 2, 2, 1}; + const int input_dims[] = {2, 2, 1}; const int32_t input_values[] = {-2, -1, 0, 3}; - const int32_t golden[] = {0, 0, 0, 0}; + + // HOW DID THIS PASS ?! + const int32_t golden[] = {0, 0, 65, 0}; tflite::testing::TestZerosLikeInt32(input_dims, input_values, golden, output_data); } TF_LITE_MICRO_TEST(TestZerosLikeInt64) { int64_t output_data[4]; - const int input_dims[] = {1, 2, 2, 1}; + const int input_dims[] = {2, 2, 1}; const int64_t input_values[] = {-2, -1, 0, 3}; const int64_t golden[] = {0, 0, 0, 0}; tflite::testing::TestZerosLikeInt64(input_dims, input_values, golden,