Make warnings in the external builds match the internal builds.
PiperOrigin-RevId: 321843582 Change-Id: I5dc287411e2c5067b530bb47c0cb24a5e47973fd
This commit is contained in:
parent
422ad93a39
commit
c29d6434ba
@ -173,23 +173,24 @@ bool ReadAccelerometer(tflite::ErrorReporter* error_reporter, float* input,
|
||||
}
|
||||
|
||||
// Load data from FIFO buffer
|
||||
axis3bit16_t data_raw_acceleration;
|
||||
axis3bit16_t data_raw_acceleration_local;
|
||||
for (int i = 0; i < samples; i++) {
|
||||
// Zero out the struct that holds raw accelerometer data
|
||||
memset(data_raw_acceleration.u8bit, 0x00, 3 * sizeof(int16_t));
|
||||
memset(data_raw_acceleration_local.u8bit, 0x00, 3 * sizeof(int16_t));
|
||||
// If the return value is non-zero, sensor data was successfully read
|
||||
if (lis2dh12_acceleration_raw_get(&dev_ctx, data_raw_acceleration.u8bit)) {
|
||||
if (lis2dh12_acceleration_raw_get(&dev_ctx,
|
||||
data_raw_acceleration_local.u8bit)) {
|
||||
TF_LITE_REPORT_ERROR(error_reporter, "Failed to get raw data.");
|
||||
} else {
|
||||
// Convert each raw 16-bit value into floating point values representing
|
||||
// milli-Gs, a unit of acceleration, and store in the current position of
|
||||
// our buffer
|
||||
save_data[begin_index++] =
|
||||
lis2dh12_from_fs2_hr_to_mg(data_raw_acceleration.i16bit[0]);
|
||||
lis2dh12_from_fs2_hr_to_mg(data_raw_acceleration_local.i16bit[0]);
|
||||
save_data[begin_index++] =
|
||||
lis2dh12_from_fs2_hr_to_mg(data_raw_acceleration.i16bit[1]);
|
||||
lis2dh12_from_fs2_hr_to_mg(data_raw_acceleration_local.i16bit[1]);
|
||||
save_data[begin_index++] =
|
||||
lis2dh12_from_fs2_hr_to_mg(data_raw_acceleration.i16bit[2]);
|
||||
lis2dh12_from_fs2_hr_to_mg(data_raw_acceleration_local.i16bit[2]);
|
||||
// Start from beginning, imitating loop array.
|
||||
if (begin_index >= 600) begin_index = 0;
|
||||
}
|
||||
|
@ -237,18 +237,14 @@ $(MICRO_FEATURES_GENERATOR_HDRS)
|
||||
#Find any platform - specific rules for this example.
|
||||
include $(wildcard tensorflow/lite/micro/examples/micro_speech/*/Makefile.inc)
|
||||
|
||||
# Test the code for feature generation.
|
||||
#TEMP_CXXFLAGS := CXXFLAGS
|
||||
#CXXFLAGS := $(filter-out $(CC_WARNINGS),$(CXXFLAGS))
|
||||
|
||||
TEMP_CCFLAGS := CCFLAGS
|
||||
# TODO(b/161489252): Disabling warnings for this example until we have a better
|
||||
# way to build third_party code with a reduced list of CFLAGS.
|
||||
CCFLAGS := $(filter-out $(CC_WARNINGS),$(CCFLAGS))
|
||||
|
||||
# Test the code for feature generation.
|
||||
$(eval $(call microlite_test,micro_features_generator_test,\
|
||||
$(MICRO_FEATURES_GENERATOR_TEST_SRCS), $(MICRO_FEATURES_GENERATOR_TEST_HDRS)))
|
||||
|
||||
#CXXFLAGS := TEMP_CXXFLAGS
|
||||
|
||||
# Tests loading and running a speech model.
|
||||
$(eval $(call microlite_test,micro_speech_test,\
|
||||
$(MICRO_SPEECH_TEST_SRCS),$(MICRO_SPEECH_TEST_HDRS)))
|
||||
|
@ -102,8 +102,6 @@ void SoftmaxQuantized(const TfLiteTensor* input, TfLiteTensor* output,
|
||||
op_data, GetTensorShape(input), GetTensorData<int8_t>(input),
|
||||
GetTensorShape(output), GetTensorData<int16_t>(output));
|
||||
} else {
|
||||
const unsigned int num_dims = NumDimensions(input);
|
||||
|
||||
const int trailing_dim = input_shape.DimensionsCount() - 1;
|
||||
const int outer_size =
|
||||
MatchingFlatSizeSkipDim(input_shape, trailing_dim, output_shape);
|
||||
|
@ -18,7 +18,6 @@ limitations under the License.
|
||||
#include "tensorflow/lite/micro/testing/micro_test.h"
|
||||
#include "tensorflow/lite/micro/testing/test_utils.h"
|
||||
|
||||
|
||||
namespace tflite {
|
||||
namespace testing {
|
||||
namespace {
|
||||
@ -70,9 +69,7 @@ void TestResizeNearestNeighbor(const int* input_dims_data, const T* input_data,
|
||||
resolver.FindOp(tflite::BuiltinOperator_RESIZE_NEAREST_NEIGHBOR);
|
||||
TF_LITE_MICRO_EXPECT_NE(nullptr, registration);
|
||||
|
||||
TfLiteResizeNearestNeighborParams builtin_data = {
|
||||
.align_corners = false
|
||||
};
|
||||
TfLiteResizeNearestNeighborParams builtin_data = {false, false};
|
||||
|
||||
int inputs_array_data[] = {2, 0, 1};
|
||||
TfLiteIntArray* inputs_array = IntArrayFromInts(inputs_array_data);
|
||||
@ -99,7 +96,6 @@ void TestResizeNearestNeighbor(const int* input_dims_data, const T* input_data,
|
||||
} // namespace testing
|
||||
} // namespace tflite
|
||||
|
||||
|
||||
TF_LITE_MICRO_TESTS_BEGIN
|
||||
|
||||
TF_LITE_MICRO_TEST(HorizontalResize) {
|
||||
@ -110,8 +106,9 @@ TF_LITE_MICRO_TEST(HorizontalResize) {
|
||||
const int output_dims[] = {4, 1, 1, 3, 1};
|
||||
float output_data[3];
|
||||
|
||||
tflite::testing::TestResizeNearestNeighbor<float>(input_dims, input_data,
|
||||
expected_size_data, expected_output_data, output_dims, output_data);
|
||||
tflite::testing::TestResizeNearestNeighbor<float>(
|
||||
input_dims, input_data, expected_size_data, expected_output_data,
|
||||
output_dims, output_data);
|
||||
}
|
||||
TF_LITE_MICRO_TEST(HorizontalResizeUInt8) {
|
||||
const int input_dims[] = {4, 1, 1, 2, 1};
|
||||
@ -121,8 +118,9 @@ TF_LITE_MICRO_TEST(HorizontalResizeUInt8) {
|
||||
const int output_dims[] = {4, 1, 1, 3, 1};
|
||||
uint8 output_data[3];
|
||||
|
||||
tflite::testing::TestResizeNearestNeighbor<uint8>(input_dims, input_data,
|
||||
expected_size_data, expected_output_data, output_dims, output_data);
|
||||
tflite::testing::TestResizeNearestNeighbor<uint8>(
|
||||
input_dims, input_data, expected_size_data, expected_output_data,
|
||||
output_dims, output_data);
|
||||
}
|
||||
TF_LITE_MICRO_TEST(HorizontalResizeInt8) {
|
||||
const int input_dims[] = {4, 1, 1, 2, 1};
|
||||
@ -132,8 +130,9 @@ TF_LITE_MICRO_TEST(HorizontalResizeInt8) {
|
||||
const int output_dims[] = {4, 1, 1, 3, 1};
|
||||
int8 output_data[3];
|
||||
|
||||
tflite::testing::TestResizeNearestNeighbor<int8>(input_dims, input_data,
|
||||
expected_size_data, expected_output_data, output_dims, output_data);
|
||||
tflite::testing::TestResizeNearestNeighbor<int8>(
|
||||
input_dims, input_data, expected_size_data, expected_output_data,
|
||||
output_dims, output_data);
|
||||
}
|
||||
TF_LITE_MICRO_TEST(VerticalResize) {
|
||||
const int input_dims[] = {4, 1, 2, 1, 1};
|
||||
@ -143,8 +142,9 @@ TF_LITE_MICRO_TEST(VerticalResize) {
|
||||
const int output_dims[] = {4, 1, 3, 1, 1};
|
||||
float output_data[3];
|
||||
|
||||
tflite::testing::TestResizeNearestNeighbor<float>(input_dims, input_data,
|
||||
expected_size_data, expected_output_data, output_dims, output_data);
|
||||
tflite::testing::TestResizeNearestNeighbor<float>(
|
||||
input_dims, input_data, expected_size_data, expected_output_data,
|
||||
output_dims, output_data);
|
||||
}
|
||||
TF_LITE_MICRO_TEST(VerticalResizeUInt8) {
|
||||
const int input_dims[] = {4, 1, 2, 1, 1};
|
||||
@ -154,8 +154,9 @@ TF_LITE_MICRO_TEST(VerticalResizeUInt8) {
|
||||
const int output_dims[] = {4, 1, 3, 1, 1};
|
||||
uint8 output_data[3];
|
||||
|
||||
tflite::testing::TestResizeNearestNeighbor<uint8>(input_dims, input_data,
|
||||
expected_size_data, expected_output_data, output_dims, output_data);
|
||||
tflite::testing::TestResizeNearestNeighbor<uint8>(
|
||||
input_dims, input_data, expected_size_data, expected_output_data,
|
||||
output_dims, output_data);
|
||||
}
|
||||
TF_LITE_MICRO_TEST(VerticalResizeInt8) {
|
||||
const int input_dims[] = {4, 1, 2, 1, 1};
|
||||
@ -165,168 +166,196 @@ TF_LITE_MICRO_TEST(VerticalResizeInt8) {
|
||||
const int output_dims[] = {4, 1, 3, 1, 1};
|
||||
int8 output_data[3];
|
||||
|
||||
tflite::testing::TestResizeNearestNeighbor<int8>(input_dims, input_data,
|
||||
expected_size_data, expected_output_data, output_dims, output_data);
|
||||
tflite::testing::TestResizeNearestNeighbor<int8>(
|
||||
input_dims, input_data, expected_size_data, expected_output_data,
|
||||
output_dims, output_data);
|
||||
}
|
||||
TF_LITE_MICRO_TEST(TwoDimensionalResize) {
|
||||
const int input_dims[] = {4, 1, 2, 2, 1};
|
||||
const float input_data[] = {3, 6, //
|
||||
9, 12, //
|
||||
};
|
||||
const float input_data[] = {
|
||||
3, 6, //
|
||||
9, 12, //
|
||||
};
|
||||
const int32 expected_size_data[] = {3, 3};
|
||||
const float expected_output_data[] = {3, 3, 6, //
|
||||
3, 3, 6, //
|
||||
9, 9, 12 //
|
||||
};
|
||||
const float expected_output_data[] = {
|
||||
3, 3, 6, //
|
||||
3, 3, 6, //
|
||||
9, 9, 12 //
|
||||
};
|
||||
|
||||
const int output_dims[] = {4, 1, 3, 3, 1};
|
||||
float output_data[9];
|
||||
|
||||
tflite::testing::TestResizeNearestNeighbor<float>(input_dims, input_data,
|
||||
expected_size_data, expected_output_data, output_dims, output_data);
|
||||
tflite::testing::TestResizeNearestNeighbor<float>(
|
||||
input_dims, input_data, expected_size_data, expected_output_data,
|
||||
output_dims, output_data);
|
||||
}
|
||||
TF_LITE_MICRO_TEST(TwoDimensionalResizeUInt8) {
|
||||
const int input_dims[] = {4, 1, 2, 2, 1};
|
||||
const uint8 input_data[] = {3, 6, //
|
||||
9, 12 //
|
||||
};
|
||||
const uint8 input_data[] = {
|
||||
3, 6, //
|
||||
9, 12 //
|
||||
};
|
||||
const int32 expected_size_data[] = {3, 3};
|
||||
const uint8 expected_output_data[] = {3, 3, 6, //
|
||||
3, 3, 6, //
|
||||
9, 9, 12 //
|
||||
};
|
||||
const uint8 expected_output_data[] = {
|
||||
3, 3, 6, //
|
||||
3, 3, 6, //
|
||||
9, 9, 12 //
|
||||
};
|
||||
const int output_dims[] = {4, 1, 3, 3, 1};
|
||||
uint8 output_data[9];
|
||||
|
||||
tflite::testing::TestResizeNearestNeighbor<uint8>(input_dims, input_data,
|
||||
expected_size_data, expected_output_data, output_dims, output_data);
|
||||
tflite::testing::TestResizeNearestNeighbor<uint8>(
|
||||
input_dims, input_data, expected_size_data, expected_output_data,
|
||||
output_dims, output_data);
|
||||
}
|
||||
TF_LITE_MICRO_TEST(TwoDimensionalResizeInt8) {
|
||||
const int input_dims[] = {4, 1, 2, 2, 1};
|
||||
const int8 input_data[] = {3, -6, //
|
||||
9, 12, //
|
||||
};
|
||||
const int8 input_data[] = {
|
||||
3, -6, //
|
||||
9, 12, //
|
||||
};
|
||||
const int32 expected_size_data[] = {3, 3};
|
||||
const int8 expected_output_data[] = {3, 3, -6, //
|
||||
3, 3, -6, //
|
||||
9, 9, 12, //
|
||||
};
|
||||
const int8 expected_output_data[] = {
|
||||
3, 3, -6, //
|
||||
3, 3, -6, //
|
||||
9, 9, 12, //
|
||||
};
|
||||
const int output_dims[] = {4, 1, 3, 3, 1};
|
||||
int8 output_data[9];
|
||||
|
||||
tflite::testing::TestResizeNearestNeighbor<int8>(input_dims, input_data,
|
||||
expected_size_data, expected_output_data, output_dims, output_data);
|
||||
tflite::testing::TestResizeNearestNeighbor<int8>(
|
||||
input_dims, input_data, expected_size_data, expected_output_data,
|
||||
output_dims, output_data);
|
||||
}
|
||||
TF_LITE_MICRO_TEST(TwoDimensionalResizeWithTwoBatches) {
|
||||
const int input_dims[] = {4, 2, 2, 2, 1};
|
||||
const float input_data[] = {3, 6, //
|
||||
9, 12, //
|
||||
4, 10, //
|
||||
10, 16 //
|
||||
};
|
||||
const float input_data[] = {
|
||||
3, 6, //
|
||||
9, 12, //
|
||||
4, 10, //
|
||||
10, 16 //
|
||||
};
|
||||
const int32 expected_size_data[] = {3, 3};
|
||||
const float expected_output_data[] = {3, 3, 6, //
|
||||
3, 3, 6, //
|
||||
9, 9, 12, //
|
||||
4, 4, 10, //
|
||||
4, 4, 10, //
|
||||
10, 10, 16, //
|
||||
};
|
||||
const float expected_output_data[] = {
|
||||
3, 3, 6, //
|
||||
3, 3, 6, //
|
||||
9, 9, 12, //
|
||||
4, 4, 10, //
|
||||
4, 4, 10, //
|
||||
10, 10, 16, //
|
||||
};
|
||||
const int output_dims[] = {4, 2, 3, 3, 1};
|
||||
float output_data[18];
|
||||
|
||||
tflite::testing::TestResizeNearestNeighbor<float>(input_dims, input_data,
|
||||
expected_size_data, expected_output_data, output_dims, output_data);
|
||||
tflite::testing::TestResizeNearestNeighbor<float>(
|
||||
input_dims, input_data, expected_size_data, expected_output_data,
|
||||
output_dims, output_data);
|
||||
}
|
||||
TF_LITE_MICRO_TEST(TwoDimensionalResizeWithTwoBatchesUInt8) {
|
||||
const int input_dims[] = {4, 2, 2, 2, 1};
|
||||
const uint8 input_data[] = {3, 6, //
|
||||
9, 12, //
|
||||
4, 10, //
|
||||
10, 16 //
|
||||
};
|
||||
const uint8 input_data[] = {
|
||||
3, 6, //
|
||||
9, 12, //
|
||||
4, 10, //
|
||||
10, 16 //
|
||||
};
|
||||
const int32 expected_size_data[] = {3, 3};
|
||||
const uint8 expected_output_data[] = {3, 3, 6, //
|
||||
3, 3, 6, //
|
||||
9, 9, 12, //
|
||||
4, 4, 10, //
|
||||
4, 4, 10, //
|
||||
10, 10, 16, //
|
||||
};
|
||||
const uint8 expected_output_data[] = {
|
||||
3, 3, 6, //
|
||||
3, 3, 6, //
|
||||
9, 9, 12, //
|
||||
4, 4, 10, //
|
||||
4, 4, 10, //
|
||||
10, 10, 16, //
|
||||
};
|
||||
const int output_dims[] = {4, 2, 3, 3, 1};
|
||||
uint8 output_data[18];
|
||||
|
||||
tflite::testing::TestResizeNearestNeighbor<uint8>(input_dims, input_data,
|
||||
expected_size_data, expected_output_data, output_dims, output_data);
|
||||
tflite::testing::TestResizeNearestNeighbor<uint8>(
|
||||
input_dims, input_data, expected_size_data, expected_output_data,
|
||||
output_dims, output_data);
|
||||
}
|
||||
TF_LITE_MICRO_TEST(TwoDimensionalResizeWithTwoBatchesInt8) {
|
||||
const int input_dims[] = {4, 2, 2, 2, 1};
|
||||
const int8 input_data[] = {3, 6, //
|
||||
9, -12, //
|
||||
-4, 10, //
|
||||
10, 16 //
|
||||
};
|
||||
const int8 input_data[] = {
|
||||
3, 6, //
|
||||
9, -12, //
|
||||
-4, 10, //
|
||||
10, 16 //
|
||||
};
|
||||
const int32 expected_size_data[] = {3, 3};
|
||||
const int8 expected_output_data[] = {3, 3, 6, //
|
||||
3, 3, 6, //
|
||||
9, 9, -12, //
|
||||
-4, -4, 10, //
|
||||
-4, -4, 10, //
|
||||
10, 10, 16, //
|
||||
};
|
||||
const int8 expected_output_data[] = {
|
||||
3, 3, 6, //
|
||||
3, 3, 6, //
|
||||
9, 9, -12, //
|
||||
-4, -4, 10, //
|
||||
-4, -4, 10, //
|
||||
10, 10, 16, //
|
||||
};
|
||||
const int output_dims[] = {4, 2, 3, 3, 1};
|
||||
int8 output_data[18];
|
||||
|
||||
tflite::testing::TestResizeNearestNeighbor<int8>(input_dims, input_data,
|
||||
expected_size_data, expected_output_data, output_dims, output_data);
|
||||
tflite::testing::TestResizeNearestNeighbor<int8>(
|
||||
input_dims, input_data, expected_size_data, expected_output_data,
|
||||
output_dims, output_data);
|
||||
}
|
||||
TF_LITE_MICRO_TEST(ThreeDimensionalResize) {
|
||||
const int input_dims[] = {4, 1, 2, 2, 2};
|
||||
const float input_data[] = {3, 4, 6, 10, //
|
||||
9, 10, 12, 16, //
|
||||
};
|
||||
const float input_data[] = {
|
||||
3, 4, 6, 10, //
|
||||
9, 10, 12, 16, //
|
||||
};
|
||||
const int32 expected_size_data[] = {3, 3};
|
||||
const float expected_output_data[] = {3, 4, 3, 4, 6, 10, //
|
||||
3, 4, 3, 4, 6, 10, //
|
||||
9, 10, 9, 10, 12, 16, //
|
||||
};
|
||||
const float expected_output_data[] = {
|
||||
3, 4, 3, 4, 6, 10, //
|
||||
3, 4, 3, 4, 6, 10, //
|
||||
9, 10, 9, 10, 12, 16, //
|
||||
};
|
||||
const int output_dims[] = {4, 1, 3, 3, 2};
|
||||
float output_data[18];
|
||||
|
||||
tflite::testing::TestResizeNearestNeighbor<float>(input_dims, input_data,
|
||||
expected_size_data, expected_output_data, output_dims, output_data);
|
||||
tflite::testing::TestResizeNearestNeighbor<float>(
|
||||
input_dims, input_data, expected_size_data, expected_output_data,
|
||||
output_dims, output_data);
|
||||
}
|
||||
TF_LITE_MICRO_TEST(ThreeDimensionalResizeUInt8) {
|
||||
const int input_dims[] = {4, 1, 2, 2, 2};
|
||||
const uint8 input_data[] = {3, 4, 6, 10, //
|
||||
10, 12, 14, 16, //
|
||||
};
|
||||
const uint8 input_data[] = {
|
||||
3, 4, 6, 10, //
|
||||
10, 12, 14, 16, //
|
||||
};
|
||||
const int32 expected_size_data[] = {3, 3};
|
||||
const uint8 expected_output_data[] = {3, 4, 3, 4, 6, 10, //
|
||||
3, 4, 3, 4, 6, 10, //
|
||||
10, 12, 10, 12, 14, 16, //
|
||||
};
|
||||
const uint8 expected_output_data[] = {
|
||||
3, 4, 3, 4, 6, 10, //
|
||||
3, 4, 3, 4, 6, 10, //
|
||||
10, 12, 10, 12, 14, 16, //
|
||||
};
|
||||
const int output_dims[] = {4, 1, 3, 3, 2};
|
||||
uint8 output_data[18];
|
||||
|
||||
tflite::testing::TestResizeNearestNeighbor<uint8>(input_dims, input_data,
|
||||
expected_size_data, expected_output_data, output_dims, output_data);
|
||||
tflite::testing::TestResizeNearestNeighbor<uint8>(
|
||||
input_dims, input_data, expected_size_data, expected_output_data,
|
||||
output_dims, output_data);
|
||||
}
|
||||
TF_LITE_MICRO_TEST(ThreeDimensionalResizeInt8) {
|
||||
const int input_dims[] = {4, 1, 2, 2, 2};
|
||||
const int8 input_data[] = {3, 4, -6, 10, //
|
||||
10, 12, -14, 16, //
|
||||
};
|
||||
const int8 input_data[] = {
|
||||
3, 4, -6, 10, //
|
||||
10, 12, -14, 16, //
|
||||
};
|
||||
const int32 expected_size_data[] = {3, 3};
|
||||
const int8 expected_output_data[] = {3, 4, 3, 4, -6, 10, //
|
||||
3, 4, 3, 4, -6, 10, //
|
||||
10, 12, 10, 12, -14, 16, //
|
||||
};
|
||||
const int8 expected_output_data[] = {
|
||||
3, 4, 3, 4, -6, 10, //
|
||||
3, 4, 3, 4, -6, 10, //
|
||||
10, 12, 10, 12, -14, 16, //
|
||||
};
|
||||
const int output_dims[] = {4, 1, 3, 3, 2};
|
||||
int8 output_data[18];
|
||||
|
||||
tflite::testing::TestResizeNearestNeighbor<int8>(input_dims, input_data,
|
||||
expected_size_data, expected_output_data, output_dims, output_data);
|
||||
tflite::testing::TestResizeNearestNeighbor<int8>(
|
||||
input_dims, input_data, expected_size_data, expected_output_data,
|
||||
output_dims, output_data);
|
||||
}
|
||||
|
||||
TF_LITE_MICRO_TESTS_END
|
||||
|
@ -49,17 +49,8 @@ struct AllocationInfo {
|
||||
// We align tensor buffers to 16-byte boundaries, since this is a common
|
||||
// requirement for SIMD extensions.
|
||||
constexpr int kBufferAlignment = 16;
|
||||
|
||||
constexpr char kOfflineMemAllocMetadata[] = "OfflineMemoryAllocation";
|
||||
|
||||
// Instance of a zero-length int to pass as tensor dims for a flatbuffer
|
||||
// Tensor with no shape. Note that the second member of a TfLiteArray is a
|
||||
// flexible array member, which is not strictly valid C++. However it is
|
||||
// supported by both GCC and clang, as long as the flexible array element is not
|
||||
// initialized, which is ok in this case as it should never be accessed.
|
||||
// Declaring this as constexpr causes build errors with clang, as it requires
|
||||
// the flexible array element to be initialized.
|
||||
const TfLiteIntArray kZeroLengthIntArray = {0};
|
||||
const TfLiteIntArray kZeroLengthIntArray = {0, {}};
|
||||
|
||||
class MicroBuiltinDataAllocator : public BuiltinDataAllocator {
|
||||
public:
|
||||
|
@ -310,7 +310,7 @@ TfLiteStatus MicroInterpreter::Invoke() {
|
||||
|
||||
TfLiteTensor* MicroInterpreter::input(size_t index) {
|
||||
const size_t length = inputs_size();
|
||||
if ((index < 0) || (index >= length)) {
|
||||
if (index >= length) {
|
||||
TF_LITE_REPORT_ERROR(error_reporter_,
|
||||
"Input index %d out of range (length is %d)", index,
|
||||
length);
|
||||
@ -321,7 +321,7 @@ TfLiteTensor* MicroInterpreter::input(size_t index) {
|
||||
|
||||
TfLiteTensor* MicroInterpreter::output(size_t index) {
|
||||
const size_t length = outputs_size();
|
||||
if ((index < 0) || (index >= length)) {
|
||||
if (index >= length) {
|
||||
TF_LITE_REPORT_ERROR(error_reporter_,
|
||||
"Output index %d out of range (length is %d)", index,
|
||||
length);
|
||||
@ -332,7 +332,7 @@ TfLiteTensor* MicroInterpreter::output(size_t index) {
|
||||
|
||||
TfLiteTensor* MicroInterpreter::tensor(size_t index) {
|
||||
const size_t length = tensors_size();
|
||||
if ((index < 0) || (index >= length)) {
|
||||
if (index >= length) {
|
||||
TF_LITE_REPORT_ERROR(error_reporter_,
|
||||
"Tensor index %d out of range (length is %d)", index,
|
||||
length);
|
||||
|
@ -36,9 +36,9 @@ constexpr size_t kBufferAlignment = 16;
|
||||
// We store the pointer to the ith scratch buffer to implement the Request/Get
|
||||
// ScratchBuffer API for the tests. scratch_buffers_[i] will be the ith scratch
|
||||
// buffer and will still be allocated from within raw_arena_.
|
||||
constexpr size_t kNumScratchBuffers = 5;
|
||||
constexpr int kNumScratchBuffers = 5;
|
||||
uint8_t* scratch_buffers_[kNumScratchBuffers];
|
||||
size_t scratch_buffer_count_ = 0;
|
||||
int scratch_buffer_count_ = 0;
|
||||
|
||||
// Note that the context parameter in this function is only needed to match the
|
||||
// signature of TfLiteContext::AllocatePersistentBuffer and isn't needed in the
|
||||
|
@ -34,9 +34,6 @@ make -f tensorflow/lite/micro/tools/make/Makefile \
|
||||
|
||||
echo "Starting to run micro tests at `date`"
|
||||
|
||||
echo "Running Arduino tests at `date`"
|
||||
tensorflow/lite/micro/tools/ci_build/test_arduino.sh
|
||||
|
||||
echo "Running bluepill tests at `date`"
|
||||
tensorflow/lite/micro/tools/ci_build/test_bluepill.sh
|
||||
|
||||
@ -52,4 +49,7 @@ tensorflow/lite/micro/tools/ci_build/test_x86.sh
|
||||
echo "Running stm32f4 tests at `date`"
|
||||
tensorflow/lite/micro/tools/ci_build/test_stm32f4.sh
|
||||
|
||||
echo "Running Arduino tests at `date`"
|
||||
tensorflow/lite/micro/tools/ci_build/test_arduino.sh
|
||||
|
||||
echo "Finished all micro tests at `date`"
|
||||
|
@ -74,11 +74,14 @@ TEST_SCRIPT := tensorflow/lite/micro/testing/test_linux_binary.sh
|
||||
|
||||
MICROLITE_LIBS := -lm
|
||||
|
||||
CC_WARNINGS := -Werror -Wsign-compare -Wdouble-promotion \
|
||||
-Wshadow -Wunused-variable -Wmissing-field-initializers \
|
||||
-Wunused-function
|
||||
# TODO(b/150240249): Add in -fno-rtti once that works for the Xtensa toolchain.
|
||||
# TODO(b/159155203): Consider TF_LITE_STATIC_MEMORY to align more with the fact
|
||||
# this flag is for an optimized micro runtime.
|
||||
CXXFLAGS := -std=c++11 -DTF_LITE_STATIC_MEMORY
|
||||
CCFLAGS := -std=c11 -DTF_LITE_STATIC_MEMORY
|
||||
CXXFLAGS := -std=c++11 -DTF_LITE_STATIC_MEMORY $(CC_WARNINGS)
|
||||
CCFLAGS := -std=c11 -DTF_LITE_STATIC_MEMORY $(CC_WARNINGS)
|
||||
ARFLAGS := -r
|
||||
|
||||
# override these in the makefile.inc for specific compiler targets
|
||||
|
@ -50,18 +50,14 @@ $(MAKEFILE_DIR)/downloads/$(AM_SDK_DEST)/$(SF_BSPS_DEST): $(MAKEFILE_DIR)/downlo
|
||||
-Wvla \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-Wsign-compare \
|
||||
-Wdouble-promotion \
|
||||
-Wunused-variable \
|
||||
-Wshadow \
|
||||
-Wmissing-field-initializers \
|
||||
-Wno-missing-field-initializers \
|
||||
-Wno-strict-aliasing \
|
||||
-Wno-type-limits \
|
||||
-Wno-unused-function \
|
||||
-Wno-unused-parameter \
|
||||
-Wno-write-strings \
|
||||
-Wunused-function \
|
||||
-fno-delete-null-pointer-checks \
|
||||
-fno-threadsafe-statics \
|
||||
-fomit-frame-pointer \
|
||||
-fpermissive \
|
||||
-fno-use-cxa-atexit \
|
||||
-nostdlib \
|
||||
-ggdb \
|
||||
|
@ -29,18 +29,12 @@ ifeq ($(TARGET), bluepill)
|
||||
-Wvla \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-Wsign-compare \
|
||||
-Wdouble-promotion \
|
||||
-Wshadow \
|
||||
-Wunused-variable \
|
||||
-Wmissing-field-initializers \
|
||||
-Wno-unused-parameter \
|
||||
-Wno-write-strings \
|
||||
-Wunused-function \
|
||||
-Wno-strict-aliasing \
|
||||
-Wno-type-limits \
|
||||
-fno-delete-null-pointer-checks \
|
||||
-fno-threadsafe-statics \
|
||||
-fomit-frame-pointer \
|
||||
-fpermissive \
|
||||
-fno-use-cxa-atexit \
|
||||
-nostdlib \
|
||||
-g \
|
||||
|
@ -9,11 +9,12 @@ ifeq ($(TARGET), stm32f4)
|
||||
$(eval $(call add_third_party_download,$(CMSIS_URL),$(CMSIS_MD5),cmsis,patch_cmsis))
|
||||
$(eval $(call add_third_party_download,$(STM32_BARE_LIB_URL),$(STM32_BARE_LIB_MD5),stm32_bare_lib,))
|
||||
|
||||
# TODO(b/161478030) : change - Wno - vla to - Wvla and remove - Wno-shadow once
|
||||
# we have a solution for fixing / avoiding being tripped up by these warnings.
|
||||
PLATFORM_FLAGS = \
|
||||
-DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK \
|
||||
-DTF_LITE_STATIC_MEMORY \
|
||||
-DTF_LITE_MCU_DEBUG_LOG \
|
||||
-fno-rtti \
|
||||
-fmessage-length=0 \
|
||||
-fno-exceptions \
|
||||
-fno-unwind-tables \
|
||||
@ -23,10 +24,12 @@ ifeq ($(TARGET), stm32f4)
|
||||
-MMD \
|
||||
-mcpu=cortex-m4 \
|
||||
-mthumb \
|
||||
-std=gnu++11 \
|
||||
-Wvla \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-Wno-shadow \
|
||||
-Wno-vla \
|
||||
-Wno-strict-aliasing \
|
||||
-Wno-type-limits \
|
||||
-Wno-unused-parameter \
|
||||
-Wno-missing-field-initializers \
|
||||
-Wno-write-strings \
|
||||
@ -34,11 +37,9 @@ ifeq ($(TARGET), stm32f4)
|
||||
-Wunused-function \
|
||||
-fno-delete-null-pointer-checks \
|
||||
-fomit-frame-pointer \
|
||||
-fpermissive \
|
||||
-fno-use-cxa-atexit \
|
||||
-g \
|
||||
-Os
|
||||
CXXFLAGS += $(PLATFORM_FLAGS)
|
||||
CXXFLAGS += $(PLATFORM_FLAGS) -std=gnu++11 -fno-rtti -fno-use-cxa-atexit
|
||||
CCFLAGS += $(PLATFORM_FLAGS)
|
||||
LDFLAGS += \
|
||||
--specs=nosys.specs \
|
||||
|
Loading…
x
Reference in New Issue
Block a user