From f464376eb13f49be73f7d074f683d465a8bcfbe8 Mon Sep 17 00:00:00 2001 From: Amit Srivastava Date: Wed, 13 Mar 2019 11:43:31 +0530 Subject: [PATCH 1/3] Fixed trivial warning in the file. Fixed some warnings in the file. --- tensorflow/lite/arena_planner.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tensorflow/lite/arena_planner.cc b/tensorflow/lite/arena_planner.cc index 8a5ef113128..4fe66ea6ebb 100644 --- a/tensorflow/lite/arena_planner.cc +++ b/tensorflow/lite/arena_planner.cc @@ -135,7 +135,7 @@ TfLiteStatus ArenaPlanner::PlanAllocations() { } // Count references to node input tensors. - for (int i = 0; i < graph_info_->num_nodes(); ++i) { + for (size_t i = 0; i < graph_info_->num_nodes(); ++i) { const TfLiteNode& node = graph_info_->node(i); TfLiteIntArray* node_inputs = node.inputs; for (int j = 0; j < node_inputs->size; ++j) { @@ -153,7 +153,7 @@ TfLiteStatus ArenaPlanner::PlanAllocations() { } } // Go through the graph in execution order. - for (int i = 0; i < graph_info_->num_nodes(); ++i) { + for (size_t i = 0; i < graph_info_->num_nodes(); ++i) { const TfLiteNode& node = graph_info_->node(i); // First queue output tensors for allocation. @@ -193,7 +193,7 @@ TfLiteStatus ArenaPlanner::ExecuteAllocations(int first_node, int last_node) { TF_LITE_ENSURE_STATUS(CalculateAllocations(first_node, last_node)); TF_LITE_ENSURE_STATUS(Commit()); - for (int i = 0; i < graph_info_->num_tensors(); ++i) { + for (size_t i = 0; i < graph_info_->num_tensors(); ++i) { // TODO(ahentz): we could do this only for the tensors that were modified // in CalculateAllocations(), instead of redoing it for tensors that // already had proper pointers. However we must be very careful, because From 2da970d881a58e75b20469b86e9864fbd4bb1082 Mon Sep 17 00:00:00 2001 From: Amit Srivastava Date: Wed, 13 Mar 2019 11:44:37 +0530 Subject: [PATCH 2/3] Fixed the interger to unsigned comparision issue. Fixed the warning in the file. --- tensorflow/lite/kernels/test_util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow/lite/kernels/test_util.h b/tensorflow/lite/kernels/test_util.h index 08c027f9d9d..4ea54837e8a 100644 --- a/tensorflow/lite/kernels/test_util.h +++ b/tensorflow/lite/kernels/test_util.h @@ -204,7 +204,7 @@ class SingleOpModel { const int channel_index = params->quantized_dimension; std::vector shape(t->dims->size); - for (int i = 0; i < shape.size(); ++i) { + for (size_t i = 0; i < shape.size(); ++i) { shape[i] = t->dims->data[i]; } const int32_t num_inputs = input_data.size(); From 0ff65890bb29fc5a38e4da4bdaf521c8448546ce Mon Sep 17 00:00:00 2001 From: Amit Srivastava Date: Wed, 13 Mar 2019 11:45:26 +0530 Subject: [PATCH 3/3] Removed the unused code from the file. Optimized the code and removed unused variables. --- tensorflow/lite/kernels/transpose_test.cc | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tensorflow/lite/kernels/transpose_test.cc b/tensorflow/lite/kernels/transpose_test.cc index 71644159209..aa8d2372101 100644 --- a/tensorflow/lite/kernels/transpose_test.cc +++ b/tensorflow/lite/kernels/transpose_test.cc @@ -40,18 +40,6 @@ void RunTestPermutation(const std::vector& shape, input[i] = i; } - // Create reversed and padded perms. - int reversed_perms[4]; - for (int output_k = 0, input_k = shape.size() - 1; output_k < shape.size(); - output_k++, input_k--) { - reversed_perms[output_k] = shape.size() - perms[input_k] - 1; - } - // Unused dimensions should not be permuted so pad with identity transform - // subset. - for (int k = shape.size(); k < 4; k++) { - reversed_perms[k] = k; - } - // Make input and output shapes. const RuntimeShape input_shape = GetTensorShape(shape); RuntimeShape output_shape(perms.size());