diff options
-rw-r--r-- | tensorflow/cc/saved_model/loader.cc | 2 | ||||
-rw-r--r-- | tensorflow/compiler/xla/client/executable_build_options.cc | 4 | ||||
-rw-r--r-- | tensorflow/contrib/cloud/kernels/bigquery_table_accessor.cc | 2 | ||||
-rw-r--r-- | tensorflow/contrib/session_bundle/session_bundle.cc | 11 | ||||
-rw-r--r-- | tensorflow/core/grappler/costs/utils.cc | 4 | ||||
-rw-r--r-- | tensorflow/core/kernels/data/iterator_ops.cc | 12 | ||||
-rw-r--r-- | tensorflow/core/lib/core/status.cc | 2 | ||||
-rw-r--r-- | tensorflow/core/platform/hadoop/hadoop_file_system.cc | 6 | ||||
-rw-r--r-- | tensorflow/core/platform/posix/posix_file_system.h | 2 | ||||
-rw-r--r-- | tensorflow/core/profiler/internal/tfprof_code.cc | 4 | ||||
-rw-r--r-- | tensorflow/examples/label_image/main.cc | 2 | ||||
-rw-r--r-- | tensorflow/python/framework/python_op_gen_main.cc | 2 | ||||
-rw-r--r-- | tensorflow/python/lib/io/file_io.i | 2 | ||||
-rw-r--r-- | tensorflow/stream_executor/cuda/cuda_gpu_executor.cc | 4 |
14 files changed, 29 insertions, 30 deletions
diff --git a/tensorflow/cc/saved_model/loader.cc b/tensorflow/cc/saved_model/loader.cc index 3830416159..222e769881 100644 --- a/tensorflow/cc/saved_model/loader.cc +++ b/tensorflow/cc/saved_model/loader.cc @@ -182,7 +182,7 @@ Status RunRestore(const RunOptions& run_options, const string& export_dir, variables_path_tensor.scalar<string>()() = variables_path; std::vector<std::pair<string, Tensor>> inputs = { - {variable_filename_const_op_name.ToString(), variables_path_tensor}}; + {string(variable_filename_const_op_name), variables_path_tensor}}; AddAssetsTensorsToInputs(export_dir, asset_file_defs, &inputs); diff --git a/tensorflow/compiler/xla/client/executable_build_options.cc b/tensorflow/compiler/xla/client/executable_build_options.cc index 75610a3818..5fe28c33df 100644 --- a/tensorflow/compiler/xla/client/executable_build_options.cc +++ b/tensorflow/compiler/xla/client/executable_build_options.cc @@ -78,7 +78,7 @@ const absl::optional<string>& ExecutableBuildOptions::generate_hlo_graph() ExecutableBuildOptions& ExecutableBuildOptions::set_dump_optimized_hlo_proto_to( tensorflow::StringPiece dirpath) { - dump_optimized_hlo_proto_to_ = dirpath.ToString(); + dump_optimized_hlo_proto_to_ = string(dirpath); return *this; } @@ -101,7 +101,7 @@ ExecutableBuildOptions::dump_unoptimized_hlo_proto_to() const { ExecutableBuildOptions& ExecutableBuildOptions::set_dump_per_pass_hlo_proto_to( tensorflow::StringPiece dirpath) { - dump_per_pass_hlo_proto_to_ = dirpath.ToString(); + dump_per_pass_hlo_proto_to_ = string(dirpath); return *this; } diff --git a/tensorflow/contrib/cloud/kernels/bigquery_table_accessor.cc b/tensorflow/contrib/cloud/kernels/bigquery_table_accessor.cc index 58fadffce3..e57a66b99f 100644 --- a/tensorflow/contrib/cloud/kernels/bigquery_table_accessor.cc +++ b/tensorflow/contrib/cloud/kernels/bigquery_table_accessor.cc @@ -33,7 +33,7 @@ bool IsPartitionEmpty(const BigQueryTablePartition& partition) { Status ParseJson(StringPiece json, Json::Value* result) { Json::Reader reader; - if (!reader.parse(json.ToString(), *result)) { + if (!reader.parse(string(json), *result)) { return errors::Internal("Couldn't parse JSON response from BigQuery."); } return Status::OK(); diff --git a/tensorflow/contrib/session_bundle/session_bundle.cc b/tensorflow/contrib/session_bundle/session_bundle.cc index cf26e3cae7..a690d9b129 100644 --- a/tensorflow/contrib/session_bundle/session_bundle.cc +++ b/tensorflow/contrib/session_bundle/session_bundle.cc @@ -138,10 +138,10 @@ Status RunRestoreOp(const RunOptions& run_options, const StringPiece export_dir, Tensor variables_tensor = CreateStringTensor(GetVariablesFilename(export_dir)); std::vector<std::pair<string, Tensor>> inputs = { - {variables_filename_const_op_name.ToString(), variables_tensor}}; + {string(variables_filename_const_op_name), variables_tensor}}; AddAssetsTensorsToInputs(export_dir, asset_files, &inputs); RunMetadata run_metadata; - return session->Run(run_options, inputs, {}, {restore_op_name.ToString()}, + return session->Run(run_options, inputs, {}, {string(restore_op_name)}, nullptr /* outputs */, &run_metadata); } @@ -152,7 +152,7 @@ Status RunInitOp(const RunOptions& run_options, const StringPiece export_dir, std::vector<std::pair<string, Tensor>> inputs; AddAssetsTensorsToInputs(export_dir, asset_files, &inputs); RunMetadata run_metadata; - return session->Run(run_options, inputs, {}, {init_op_name.ToString()}, + return session->Run(run_options, inputs, {}, {string(init_op_name)}, nullptr /* outputs */, &run_metadata); } @@ -251,15 +251,14 @@ Status LoadSessionBundleFromPathUsingRunOptions(const SessionOptions& options, auto log_and_count = [&](const string& status_str) { LOG(INFO) << "Loading SessionBundle: " << status_str << ". Took " << load_latency_microsecs << " microseconds."; - load_attempt_count->GetCell(export_dir.ToString(), status_str) - ->IncrementBy(1); + load_attempt_count->GetCell(string(export_dir), status_str)->IncrementBy(1); }; if (status.ok()) { log_and_count(kLoadAttemptSuccess); } else { log_and_count(kLoadAttemptFail); } - load_latency->GetCell(export_dir.ToString()) + load_latency->GetCell(string(export_dir)) ->IncrementBy(load_latency_microsecs); return status; } diff --git a/tensorflow/core/grappler/costs/utils.cc b/tensorflow/core/grappler/costs/utils.cc index be54d98534..aad00ce039 100644 --- a/tensorflow/core/grappler/costs/utils.cc +++ b/tensorflow/core/grappler/costs/utils.cc @@ -99,7 +99,7 @@ static void ExtractExtraProperties( continue; } TensorId input_tensor_id = ParseTensorName(input_name); - const string input_node_name = input_tensor_id.first.ToString(); + const string input_node_name(input_tensor_id.first); auto iter = name_to_node.find(input_node_name); if (iter == name_to_node.end()) continue; @@ -172,7 +172,7 @@ std::vector<OpInfo::TensorProperties> FindInputFeatures( for (const auto& input_name : node.input()) { CHECK(!input_name.empty()); TensorId input_tensor_id = ParseTensorName(input_name); - const string input_node_name = input_tensor_id.first.ToString(); + const string input_node_name(input_tensor_id.first); const int output_index = input_tensor_id.second; // Skip control inputs. diff --git a/tensorflow/core/kernels/data/iterator_ops.cc b/tensorflow/core/kernels/data/iterator_ops.cc index b2a45dac1e..4e9b280968 100644 --- a/tensorflow/core/kernels/data/iterator_ops.cc +++ b/tensorflow/core/kernels/data/iterator_ops.cc @@ -261,7 +261,7 @@ class VariantTensorDataReader : public IteratorStateReader { } bool Contains(StringPiece key) override { - return map_.find(key.ToString()) != map_.end(); + return map_.find(string(key)) != map_.end(); } private: @@ -282,18 +282,18 @@ class VariantTensorDataReader : public IteratorStateReader { template <typename T> Status ReadScalarInternal(StringPiece key, T* val) { - if (map_.find(key.ToString()) == map_.end()) { + if (map_.find(string(key)) == map_.end()) { return errors::NotFound(key); } - *val = data_->tensors(map_[key.ToString()]).scalar<T>()(); + *val = data_->tensors(map_[string(key)]).scalar<T>()(); return Status::OK(); } Status ReadTensorInternal(StringPiece key, Tensor* val) { - if (map_.find(key.ToString()) == map_.end()) { + if (map_.find(string(key)) == map_.end()) { return errors::NotFound(key); } - *val = data_->tensors(map_[key.ToString()]); + *val = data_->tensors(map_[string(key)]); return Status::OK(); } @@ -342,7 +342,7 @@ class VariantTensorDataWriter : public IteratorStateWriter { // Write key to the metadata proto. This gets written to `data_` // when `Flush()` is called. We do this lazily to avoid multiple // serialization calls. - metadata_proto_.add_keys(key.ToString()); + metadata_proto_.add_keys(string(key)); // Update tensors. *(data_->add_tensors()) = val; diff --git a/tensorflow/core/lib/core/status.cc b/tensorflow/core/lib/core/status.cc index 12dfcd284f..cb2a06e620 100644 --- a/tensorflow/core/lib/core/status.cc +++ b/tensorflow/core/lib/core/status.cc @@ -22,7 +22,7 @@ Status::Status(tensorflow::error::Code code, StringPiece msg) { assert(code != tensorflow::error::OK); state_ = std::unique_ptr<State>(new State); state_->code = code; - state_->msg = msg.ToString(); + state_->msg = string(msg); } void Status::Update(const Status& new_status) { diff --git a/tensorflow/core/platform/hadoop/hadoop_file_system.cc b/tensorflow/core/platform/hadoop/hadoop_file_system.cc index ff4b4436bb..8cdb08f51b 100644 --- a/tensorflow/core/platform/hadoop/hadoop_file_system.cc +++ b/tensorflow/core/platform/hadoop/hadoop_file_system.cc @@ -144,7 +144,7 @@ Status HadoopFileSystem::Connect(StringPiece fname, hdfsFS* fs) { StringPiece scheme, namenode, path; io::ParseURI(fname, &scheme, &namenode, &path); - const string nn = namenode.ToString(); + const string nn(namenode); hdfsBuilder* builder = hdfs_->hdfsNewBuilder(); if (scheme == "file") { @@ -183,7 +183,7 @@ Status HadoopFileSystem::Connect(StringPiece fname, hdfsFS* fs) { string HadoopFileSystem::TranslateName(const string& name) const { StringPiece scheme, namenode, path; io::ParseURI(name, &scheme, &namenode, &path); - return path.ToString(); + return string(path); } class HDFSRandomAccessFile : public RandomAccessFile { @@ -392,7 +392,7 @@ Status HadoopFileSystem::GetChildren(const string& dir, return IOError(dir, errno); } for (int i = 0; i < entries; i++) { - result->push_back(io::Basename(info[i].mName).ToString()); + result->push_back(string(io::Basename(info[i].mName))); } hdfs_->hdfsFreeFileInfo(info, entries); return Status::OK(); diff --git a/tensorflow/core/platform/posix/posix_file_system.h b/tensorflow/core/platform/posix/posix_file_system.h index e8898d0a97..752eccea66 100644 --- a/tensorflow/core/platform/posix/posix_file_system.h +++ b/tensorflow/core/platform/posix/posix_file_system.h @@ -70,7 +70,7 @@ class LocalPosixFileSystem : public PosixFileSystem { string TranslateName(const string& name) const override { StringPiece scheme, host, path; io::ParseURI(name, &scheme, &host, &path); - return path.ToString(); + return string(path); } }; diff --git a/tensorflow/core/profiler/internal/tfprof_code.cc b/tensorflow/core/profiler/internal/tfprof_code.cc index 2c4f52e3ad..744e1e95de 100644 --- a/tensorflow/core/profiler/internal/tfprof_code.cc +++ b/tensorflow/core/profiler/internal/tfprof_code.cc @@ -37,7 +37,7 @@ const char* const kGradientSuffix = " (gradient)"; // Convert to Trace proto into a short readable string. string GetTraceString(const CallStack::Trace& trace) { - string ntrace = io::Basename(trace.file()).ToString(); + string ntrace(io::Basename(trace.file())); ntrace += strings::StrCat(":", trace.lineno()); if (trace.function().length() < 20) { ntrace += ":" + trace.function(); @@ -113,7 +113,7 @@ class FunctionTable { // function index should start from 1. func_pb->set_id(function_table_.size()); - string file_base = io::Basename(file_path).ToString(); + string file_base(io::Basename(file_path)); file_base = file_base.substr(0, file_base.find_last_of(".")); func_pb->set_name( string_table_->GetIndex(strings::StrCat(file_base, ":", func_name))); diff --git a/tensorflow/examples/label_image/main.cc b/tensorflow/examples/label_image/main.cc index baa65d3243..ee2927d0a5 100644 --- a/tensorflow/examples/label_image/main.cc +++ b/tensorflow/examples/label_image/main.cc @@ -106,7 +106,7 @@ static Status ReadEntireFile(tensorflow::Env* env, const string& filename, "' expected ", file_size, " got ", data.size()); } - output->scalar<string>()() = data.ToString(); + output->scalar<string>()() = string(data); return Status::OK(); } diff --git a/tensorflow/python/framework/python_op_gen_main.cc b/tensorflow/python/framework/python_op_gen_main.cc index 8eb943b960..e20ad5fd33 100644 --- a/tensorflow/python/framework/python_op_gen_main.cc +++ b/tensorflow/python/framework/python_op_gen_main.cc @@ -52,7 +52,7 @@ Status ReadOpListFromFile(const string& filename, if (scanner.One(strings::Scanner::LETTER_DIGIT_DOT) .Any(strings::Scanner::LETTER_DIGIT_DASH_DOT_SLASH_UNDERSCORE) .GetResult(nullptr, &op_name)) { - op_list->emplace_back(op_name.ToString()); + op_list->emplace_back(op_name); } s = input_buffer->ReadLine(&line_contents); } diff --git a/tensorflow/python/lib/io/file_io.i b/tensorflow/python/lib/io/file_io.i index 891a7b0fd0..0aa08ea3d1 100644 --- a/tensorflow/python/lib/io/file_io.i +++ b/tensorflow/python/lib/io/file_io.i @@ -42,7 +42,7 @@ inline void FileExists(const string& filename, TF_Status* out_status) { inline void FileExists(const tensorflow::StringPiece& filename, TF_Status* out_status) { tensorflow::Status status = - tensorflow::Env::Default()->FileExists(filename.ToString()); + tensorflow::Env::Default()->FileExists(string(filename)); if (!status.ok()) { Set_TF_Status_from_Status(out_status, status); } diff --git a/tensorflow/stream_executor/cuda/cuda_gpu_executor.cc b/tensorflow/stream_executor/cuda/cuda_gpu_executor.cc index 73f05b94db..e30f50ea2a 100644 --- a/tensorflow/stream_executor/cuda/cuda_gpu_executor.cc +++ b/tensorflow/stream_executor/cuda/cuda_gpu_executor.cc @@ -164,8 +164,8 @@ bool CUDAExecutor::FindOnDiskForComputeCapability( VLOG(2) << "could not find compute-capability specific file at: " << cc_specific; - if (port::FileExists(filename.ToString()).ok()) { - *found_filename = filename.ToString(); + if (port::FileExists(string(filename)).ok()) { + *found_filename = string(filename); return true; } |