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
This commit is contained in:
Dero Gharibian 2019-08-12 19:39:50 -07:00 committed by TensorFlower Gardener
parent 56bd72ef65
commit f05a57eefe
2 changed files with 8 additions and 6 deletions

View File

@ -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>()() = string(data);
output->scalar<tstring>()() = tstring(data);
return Status::OK();
}

View File

@ -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<string>()() = wav_string;
wav_tensor.scalar<tstring>()() = wav_string;
// Actually run the audio through the model.
std::vector<Tensor> outputs;