From f05a57eefe9f03c9fae83d0fcb727ee07949d963 Mon Sep 17 00:00:00 2001 From: Dero Gharibian Date: Mon, 12 Aug 2019 19:39:50 -0700 Subject: [PATCH] Updated examples/ to use tstring. This is a part of a larger migration effort for tensorflow::tstring. See: https://github.com/tensorflow/community/pull/91 PiperOrigin-RevId: 263055479 --- tensorflow/examples/label_image/main.cc | 7 ++++--- tensorflow/examples/speech_commands/label_wav.cc | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tensorflow/examples/label_image/main.cc b/tensorflow/examples/label_image/main.cc index ee2927d0a53..d76fc8046f3 100644 --- a/tensorflow/examples/label_image/main.cc +++ b/tensorflow/examples/label_image/main.cc @@ -60,10 +60,11 @@ limitations under the License. // These are all common classes it's handy to reference with no namespace. using tensorflow::Flag; -using tensorflow::Tensor; +using tensorflow::int32; using tensorflow::Status; using tensorflow::string; -using tensorflow::int32; +using tensorflow::Tensor; +using tensorflow::tstring; // Takes a file name, and loads a list of labels from it, one per line, and // returns a vector of the strings. It pads with empty strings so the length @@ -106,7 +107,7 @@ static Status ReadEntireFile(tensorflow::Env* env, const string& filename, "' expected ", file_size, " got ", data.size()); } - output->scalar()() = string(data); + output->scalar()() = tstring(data); return Status::OK(); } diff --git a/tensorflow/examples/speech_commands/label_wav.cc b/tensorflow/examples/speech_commands/label_wav.cc index d8267388317..f505da22648 100644 --- a/tensorflow/examples/speech_commands/label_wav.cc +++ b/tensorflow/examples/speech_commands/label_wav.cc @@ -26,10 +26,11 @@ limitations under the License. // These are all common classes it's handy to reference with no namespace. using tensorflow::Flag; -using tensorflow::Status; -using tensorflow::Tensor; using tensorflow::int32; +using tensorflow::Status; using tensorflow::string; +using tensorflow::Tensor; +using tensorflow::tstring; namespace { @@ -149,7 +150,7 @@ int main(int argc, char* argv[]) { return -1; } Tensor wav_tensor(tensorflow::DT_STRING, tensorflow::TensorShape({})); - wav_tensor.scalar()() = wav_string; + wav_tensor.scalar()() = wav_string; // Actually run the audio through the model. std::vector outputs;