Why does tensorflow/lite/micro/kernels/zeros_like_test.cc pass?
This commit is contained in:
parent
7108450567
commit
2631b7f7c0
@ -38,7 +38,7 @@ TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
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<T>(0);
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#include <iostream>
|
||||
#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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user