aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow
diff options
context:
space:
mode:
authorGravatar Shashi Shekhar <shashishekhar@google.com>2018-06-11 11:03:57 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-06-11 11:08:13 -0700
commitb5e7264395f1791d682b85463285d7933efda9c2 (patch)
tree39cc7037e227465dafe1a0b80e9416bf41d7ebb6 /tensorflow
parent530dc71d0487cacccbe270490d460bc401040dc9 (diff)
Remove a few redundant benchmark parameters.
PiperOrigin-RevId: 200079299
Diffstat (limited to 'tensorflow')
-rw-r--r--tensorflow/contrib/lite/tools/benchmark/README.md4
-rw-r--r--tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.cc50
-rw-r--r--tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.h4
3 files changed, 1 insertions, 57 deletions
diff --git a/tensorflow/contrib/lite/tools/benchmark/README.md b/tensorflow/contrib/lite/tools/benchmark/README.md
index 2788f76faf..c10826afff 100644
--- a/tensorflow/contrib/lite/tools/benchmark/README.md
+++ b/tensorflow/contrib/lite/tools/benchmark/README.md
@@ -46,8 +46,6 @@ adb shell /data/local/tmp/benchmark_model \
--graph=/data/local/tmp/mobilenet_quant_v1_224.tflite \
--input_layer="Placeholder" \
--input_layer_shape="1,224,224,3" \
- --input_layer_type="uint8" \
- --output_layer="MobilenetV1/Predictions/Reshape_1" \
--num_threads=4
```
@@ -66,8 +64,6 @@ bazel-bin/tensorflow/contrib/lite/tools/benchmark/benchmark_model \
--graph=mobilenet_quant_v1_224.tflite \
--input_layer="Placeholder" \
--input_layer_shape="1,224,224,3" \
- --input_layer_type="uint8" \
- --output_layer="MobilenetV1/Predictions/Reshape_1" \
--num_threads=4
```
diff --git a/tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.cc b/tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.cc
index 2e5b866273..5f803cec19 100644
--- a/tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.cc
+++ b/tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.cc
@@ -123,29 +123,11 @@ void FillRandomString(tflite::DynamicBuffer* buffer,
}
}
-TfLiteType TfLiteTypeFromString(const string& input_layer_type) {
- if (input_layer_type == "string")
- return kTfLiteString;
- else if (input_layer_type == "float")
- return kTfLiteFloat32;
- else if (input_layer_type == "uint8")
- return kTfLiteUInt8;
- else if (input_layer_type == "int32")
- return kTfLiteInt32;
- else if (input_layer_type == "int64")
- return kTfLiteInt64;
- else
- return kTfLiteNoType;
-}
-
bool PopulateInputLayerInfo(
const string& names_string, const string& shapes_string,
- const string& types_string, const string& values_string,
std::vector<BenchmarkTfLiteModel::InputLayerInfo>* info) {
std::vector<std::string> names = Split(names_string, ',');
std::vector<std::string> shapes = Split(shapes_string, ':');
- std::vector<std::string> types = Split(types_string, ',');
- std::vector<std::string> values = Split(values_string, ':');
if (names.size() != shapes.size()) {
TFLITE_LOG(ERROR) << "The number of items in"
@@ -158,17 +140,6 @@ bool PopulateInputLayerInfo(
<< " --input_layer_shape=1,224,224,4:1,20";
return false;
}
- if (names.size() != types.size()) {
- TFLITE_LOG(ERROR) << "The number of items in"
- << " --input_layer_type (" << types_string << ", with "
- << types.size() << " items)"
- << " must match the number of items in"
- << " --input_layer (" << names_string << ", with "
- << names.size() << " items)."
- << " For example --input_layer=input1,input2"
- << " --input_layer_type=float,int";
- return false;
- }
for (int i = 0; i < names.size(); ++i) {
info->push_back(BenchmarkTfLiteModel::InputLayerInfo());
@@ -176,10 +147,6 @@ bool PopulateInputLayerInfo(
input.name = names[i];
- input.data_type = TfLiteTypeFromString(types[i]);
- TFLITE_BENCHMARK_CHECK(input.data_type != kTfLiteNoType)
- << types[i] << " was an invalid type";
-
TFLITE_BENCHMARK_CHECK(SplitAndParse(shapes[i], ',', &input.shape))
<< "Incorrect size string specified: " << shapes[i];
for (int dim : input.shape) {
@@ -190,12 +157,6 @@ bool PopulateInputLayerInfo(
return false;
}
}
-
- if (i < values.size()) {
- TFLITE_BENCHMARK_CHECK(
- SplitAndParse(values[i], ',', &input.initialization_values))
- << "Incorrect initialization values string specified: " << values[i];
- }
}
return true;
@@ -209,10 +170,6 @@ std::vector<Flag> BenchmarkTfLiteModel::GetFlags() {
Flag("graph", &graph, "graph file name"),
Flag("input_layer", &input_layer_string, "input layer names"),
Flag("input_layer_shape", &input_layer_shape_string, "input layer shape"),
- Flag("input_layer_type", &input_layer_type_string, "input layer type"),
- Flag("input_layer_values", &input_layer_values_string,
- "values to initialize the inputs with"),
- Flag("output_layer", &output_layer_string, "output layer name"),
Flag("use_nnapi", &use_nnapi, "use nnapi api")};
flags.insert(flags.end(), specific_flags.begin(), specific_flags.end());
@@ -224,8 +181,6 @@ void BenchmarkTfLiteModel::LogFlags() {
TFLITE_LOG(INFO) << "Graph: [" << graph << "]";
TFLITE_LOG(INFO) << "Input layers: [" << input_layer_string << "]";
TFLITE_LOG(INFO) << "Input shapes: [" << input_layer_shape_string << "]";
- TFLITE_LOG(INFO) << "Input types: [" << input_layer_type_string << "]";
- TFLITE_LOG(INFO) << "Output layers: [" << output_layer_string << "]";
TFLITE_LOG(INFO) << "Use nnapi : [" << use_nnapi << "]";
}
@@ -236,8 +191,7 @@ bool BenchmarkTfLiteModel::ValidateFlags() {
return false;
}
return PopulateInputLayerInfo(input_layer_string, input_layer_shape_string,
- input_layer_type_string,
- input_layer_values_string, &inputs);
+ &inputs);
}
uint64_t BenchmarkTfLiteModel::ComputeInputBytes() {
@@ -293,8 +247,6 @@ void BenchmarkTfLiteModel::Init() {
TFLITE_BENCHMARK_CHECK_EQ(t->name, input.name)
<< "Tensor # " << i << " is named " << t->name << " but flags call it "
<< input.name;
- TFLITE_BENCHMARK_CHECK_EQ(t->type, input.data_type)
- << "Could not match the type of input tensor " << t->name;
}
// Resize all non-string tensors.
diff --git a/tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.h b/tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.h
index e70f6de1bf..ffb93da964 100644
--- a/tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.h
+++ b/tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.h
@@ -64,10 +64,7 @@ class BenchmarkTfLiteModel : public BenchmarkModel {
struct InputLayerInfo {
std::string name;
- TfLiteType data_type;
std::vector<int> shape;
- // Note that initialization_values is currently unused.
- std::vector<float> initialization_values;
};
private:
@@ -78,7 +75,6 @@ class BenchmarkTfLiteModel : public BenchmarkModel {
std::string input_layer_type_string;
std::string input_layer_shape_string;
std::string input_layer_values_string;
- std::string output_layer_string;
std::vector<InputLayerInfo> inputs;
bool use_nnapi;
ProfilingListener profiling_listener_;