Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made the variable const #26509

Merged
merged 4 commits into from Apr 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions tensorflow/lite/kernels/detection_postprocess.cc
Expand Up @@ -130,7 +130,7 @@ TfLiteStatus SetTensorSizes(TfLiteContext* context, TfLiteTensor* tensor,
std::initializer_list<int> values) {
TfLiteIntArray* size = TfLiteIntArrayCreate(values.size());
int index = 0;
for (int v : values) {
for (const auto& v : values) {
size->data[index] = v;
++index;
}
Expand Down Expand Up @@ -503,7 +503,7 @@ TfLiteStatus NonMaxSuppressionMultiClassRegularHelper(TfLiteContext* context,
num_detections_per_class));
// Add selected indices from non-max suppression of boxes in this class
int output_index = size_of_sorted_indices;
for (int selected_index : selected) {
for (const auto& selected_index : selected) {
box_indices_after_regular_non_max_suppression[output_index] =
(selected_index * num_classes_with_background + col + label_offset);
scores_after_regular_non_max_suppression[output_index] =
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/lite/kernels/kernel_util_test.cc
Expand Up @@ -44,7 +44,7 @@ class KernelUtilTest : public ::testing::Test {
TfLiteTensorFree(tensor);
tensor->dims = TfLiteIntArrayCreate(dims.size());
int i = 0;
for (int d : dims) {
for (const auto& d : dims) {
tensor->dims->data[i] = d;
++i;
}
Expand Down
10 changes: 5 additions & 5 deletions tensorflow/lite/kernels/test_util.h
Expand Up @@ -46,7 +46,7 @@ template <typename T>
inline std::vector<T> Quantize(const std::vector<float>& data, float scale,
int32_t zero_point) {
std::vector<T> q;
for (float f : data) {
for (const auto& f : data) {
q.push_back(static_cast<T>(std::max<float>(
std::numeric_limits<T>::min(),
std::min<float>(std::numeric_limits<T>::max(),
Expand All @@ -59,7 +59,7 @@ template <typename T>
inline std::vector<float> Dequantize(const std::vector<T>& data, float scale,
int32_t zero_point) {
std::vector<float> f;
for (T q : data) {
for (const T& q : data) {
f.push_back(scale * (q - zero_point));
}
return f;
Expand Down Expand Up @@ -276,7 +276,7 @@ class SingleOpModel {
<< ". Requested " << typeToTfLiteType<T>() << ", got "
<< t->type;
}
for (T f : data) {
for (const T& f : data) {
*v = f;
++v;
}
Expand All @@ -296,7 +296,7 @@ class SingleOpModel {
<< ". Requested " << typeToTfLiteType<T>() << ", got "
<< t->type;
}
for (T f : data) {
for (const T& f : data) {
*v = f;
++v;
}
Expand Down Expand Up @@ -496,7 +496,7 @@ class SingleOpTest : public ::testing::TestWithParam<string> {
static std::vector<string> GetKernelTags(
const std::map<string, TfLiteRegistration*>& kernel_map) {
std::vector<string> tags;
for (auto it : kernel_map) {
for (const auto& it : kernel_map) {
tags.push_back(it.first);
}
return tags;
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/lite/toco/tflite/export_test.cc
Expand Up @@ -251,7 +251,7 @@ class OpSetsTest : public ExportTest {
params_.enable_select_tf_ops = false;
params_.quantize_weights = false;

for (OpSet i : sets) {
for (const OpSet& i : sets) {
switch (i) {
case kTfLiteBuiltins:
import_all_ops_as_unsupported_ = false;
Expand Down