Skip to content

Commit

Permalink
Rename method to clarify intent.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 306381156
  • Loading branch information
netfs authored and tensorflow-copybara committed Apr 14, 2020
1 parent 2fb96fa commit 9feac12
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tensorflow_serving/servables/tensorflow/tflite_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ Status TfLiteTypeToTfType(TfLiteType tflite_type, DataType* type) {
return Status::OK();
}

std::string TfLiteToTensorName(const string& name) {
std::string TfToTfLiteTensorName(const string& tf_name) {
// TF variable names have ':0' suffix, TF Lite variables dont.
std::pair<absl::string_view, absl::string_view> name_index =
absl::StrSplit(name, absl::MaxSplits(':', 1));
absl::StrSplit(tf_name, absl::MaxSplits(':', 1));
return std::string(name_index.first);
}

Expand Down Expand Up @@ -299,7 +299,7 @@ Status TfLiteSession::Run(
// happen in-parallel.
absl::MutexLock lock(&mutex_);
for (const auto& input : inputs) {
const string& name = TfLiteToTensorName(input.first);
const string& name = TfToTfLiteTensorName(input.first);
if (input_tensor_to_index_.find(name) == input_tensor_to_index_.end()) {
return errors::InvalidArgument("Missing input TFLite tensor: ", name);
}
Expand All @@ -314,7 +314,7 @@ Status TfLiteSession::Run(

outputs->clear();
for (const auto& tfname : output_tensor_names) {
const string& name = TfLiteToTensorName(tfname);
const string& name = TfToTfLiteTensorName(tfname);
if (output_tensor_to_index_.find(name) == output_tensor_to_index_.end()) {
return errors::InvalidArgument("Missing output TFLite tensor: ", name);
}
Expand Down

0 comments on commit 9feac12

Please sign in to comment.