parent
333c4ff556
commit
3f23f4ddea
tensorflow
c
cc
compiler
jit
tf2xla/kernels
xla/tools
contrib
android
bigtable/kernels
cloud/kernels
ffmpeg
gdr
layers/kernels
libsvm/kernels
lite/delegates/flex
nccl/kernels
saved_model/cc/saved_model
session_bundle
tensorboard/db
tpu/profiler
verbs
core
BUILD
common_runtime
constant_folding_test.cccopy_tensor.cccopy_tensor.hdevice_mgr.ccdevice_mgr.hdevice_set.ccdirect_session.ccdirect_session.hdirect_session_test.cc
eager
function.ccfunction.hfunction_test.ccgpu
gpu_device_context.hlower_if_while_test.ccplacer.ccprofile_handler.hshape_refiner.ccstep_stats_collector.ccdebug
distributed_runtime
BUILDbase_rendezvous_mgr.ccmaster_session.ccremote_device.cc
rpc
BUILDgrpc_master_service.ccgrpc_remote_master.ccgrpc_session_test.ccgrpc_tensor_coding.ccgrpc_tensorflow_server.ccgrpc_testlib_server.ccrpc_rendezvous_mgr.cc
tensor_coding.ccexample
framework
@ -78,12 +78,10 @@ tf_cuda_library(
|
||||
deps = select({
|
||||
"//tensorflow:android": [
|
||||
":c_api_internal",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//tensorflow/core:android_tensorflow_lib_lite",
|
||||
],
|
||||
"//conditions:default": [
|
||||
":c_api_internal",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//tensorflow/cc/saved_model:loader",
|
||||
"//tensorflow/cc:gradients",
|
||||
"//tensorflow/cc:ops",
|
||||
@ -230,7 +228,6 @@ tf_cuda_cc_test(
|
||||
"//tensorflow/core/kernels:array",
|
||||
"//tensorflow/core/kernels:control_flow_ops",
|
||||
"//tensorflow/core/kernels:math",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -19,7 +19,6 @@ limitations under the License.
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "absl/strings/string_view.h"
|
||||
|
||||
#ifndef __ANDROID__
|
||||
#include "tensorflow/cc/framework/gradients.h"
|
||||
@ -52,6 +51,7 @@ limitations under the License.
|
||||
#include "tensorflow/core/lib/core/coding.h"
|
||||
#include "tensorflow/core/lib/core/errors.h"
|
||||
#include "tensorflow/core/lib/core/status.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/lib/gtl/array_slice.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
@ -120,7 +120,7 @@ void TF_SetStatus(TF_Status* s, TF_Code code, const char* msg) {
|
||||
s->status = Status::OK();
|
||||
return;
|
||||
}
|
||||
s->status = Status(static_cast<Code>(code), absl::string_view(msg));
|
||||
s->status = Status(static_cast<Code>(code), tensorflow::StringPiece(msg));
|
||||
}
|
||||
|
||||
TF_Code TF_GetCode(const TF_Status* s) {
|
||||
@ -1160,7 +1160,7 @@ void TF_ColocateWith(TF_OperationDescription* desc, TF_Operation* op) {
|
||||
|
||||
void TF_SetAttrString(TF_OperationDescription* desc, const char* attr_name,
|
||||
const void* value, size_t length) {
|
||||
absl::string_view s(static_cast<const char*>(value), length);
|
||||
tensorflow::StringPiece s(static_cast<const char*>(value), length);
|
||||
desc->node_builder.Attr(attr_name, s);
|
||||
}
|
||||
|
||||
@ -1174,7 +1174,7 @@ void TF_SetAttrStringList(TF_OperationDescription* desc, const char* attr_name,
|
||||
lengths[i]);
|
||||
}
|
||||
} else {
|
||||
std::vector<absl::string_view> v;
|
||||
std::vector<tensorflow::StringPiece> v;
|
||||
v.reserve(num_values);
|
||||
for (int i = 0; i < num_values; ++i) {
|
||||
v.emplace_back(static_cast<const char*>(values[i]), lengths[i]);
|
||||
|
@ -13,7 +13,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/c/c_api_internal.h"
|
||||
|
||||
#include <algorithm>
|
||||
@ -325,7 +324,7 @@ Status GraphToFunctionDef(const Graph& fn_body, const string& fn_name,
|
||||
TF_RETURN_IF_ERROR(
|
||||
NameRangesForNode(*node, node->op_def(), nullptr, &output_ranges));
|
||||
for (const auto& output : output_ranges) {
|
||||
const absl::string_view& output_name = output.first;
|
||||
const StringPiece& output_name = output.first;
|
||||
int index_start = output.second.first;
|
||||
int index_end = output.second.second;
|
||||
for (int i = index_start; i < index_end; ++i) {
|
||||
@ -365,7 +364,7 @@ Status GraphToFunctionDef(const Graph& fn_body, const string& fn_name,
|
||||
const uint64 hash = FunctionDefHash(*fdef);
|
||||
string encoded;
|
||||
TF_RETURN_IF_ERROR(Base64Encode(
|
||||
absl::string_view(reinterpret_cast<const char*>(&hash), sizeof(hash)),
|
||||
StringPiece(reinterpret_cast<const char*>(&hash), sizeof(hash)),
|
||||
&encoded));
|
||||
// Besides letters and digits our Base64 encoding uses '_' and '-'.
|
||||
// Dash is invalid in operation names and multiple underscores in random
|
||||
|
@ -21,7 +21,6 @@ limitations under the License.
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/c/c_test_util.h"
|
||||
#include "tensorflow/cc/saved_model/signature_constants.h"
|
||||
#include "tensorflow/cc/saved_model/tag_constants.h"
|
||||
@ -56,7 +55,7 @@ Status TF_TensorToTensor(const TF_Tensor* src, Tensor* dst);
|
||||
|
||||
namespace {
|
||||
|
||||
static void ExpectHasSubstr(absl::string_view s, absl::string_view expected) {
|
||||
static void ExpectHasSubstr(StringPiece s, StringPiece expected) {
|
||||
EXPECT_TRUE(str_util::StrContains(s, expected))
|
||||
<< "'" << s << "' does not contain '" << expected << "'";
|
||||
}
|
||||
|
@ -50,7 +50,6 @@ tf_cuda_library(
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + [
|
||||
"@com_google_absl//absl/strings",
|
||||
"//tensorflow/core/common_runtime/eager:eager_operation",
|
||||
"//tensorflow/core/distributed_runtime/eager:eager_client",
|
||||
"//tensorflow/core/distributed_runtime/rpc/eager:grpc_eager_client",
|
||||
|
@ -21,7 +21,6 @@ limitations under the License.
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/c/c_api.h"
|
||||
#include "tensorflow/c/c_api_internal.h"
|
||||
#include "tensorflow/c/eager/c_api_internal.h"
|
||||
@ -47,6 +46,7 @@ limitations under the License.
|
||||
#include "tensorflow/core/framework/tensor_shape.pb.h"
|
||||
#include "tensorflow/core/framework/types.h"
|
||||
#include "tensorflow/core/lib/core/refcount.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/lib/gtl/cleanup.h"
|
||||
#include "tensorflow/core/lib/gtl/flatmap.h"
|
||||
#include "tensorflow/core/lib/gtl/map_util.h"
|
||||
@ -526,7 +526,8 @@ TF_AttrType TFE_OpNameGetAttrType(TFE_Context* ctx,
|
||||
void TFE_OpSetAttrString(TFE_Op* op, const char* attr_name, const void* value,
|
||||
size_t length) {
|
||||
op->operation.MutableAttrs()->Set(
|
||||
attr_name, absl::string_view(static_cast<const char*>(value), length));
|
||||
attr_name,
|
||||
tensorflow::StringPiece(static_cast<const char*>(value), length));
|
||||
}
|
||||
|
||||
void TFE_OpSetAttrInt(TFE_Op* op, const char* attr_name, int64_t value) {
|
||||
@ -595,9 +596,10 @@ void TFE_OpSetAttrTensor(TFE_Op* op, const char* attr_name, TF_Tensor* tensor,
|
||||
void TFE_OpSetAttrStringList(TFE_Op* op, const char* attr_name,
|
||||
const void* const* values, const size_t* lengths,
|
||||
int num_values) {
|
||||
std::vector<absl::string_view> v(num_values);
|
||||
std::vector<tensorflow::StringPiece> v(num_values);
|
||||
for (int i = 0; i < num_values; ++i) {
|
||||
v[i] = absl::string_view(static_cast<const char*>(values[i]), lengths[i]);
|
||||
v[i] = tensorflow::StringPiece(static_cast<const char*>(values[i]),
|
||||
lengths[i]);
|
||||
}
|
||||
op->operation.MutableAttrs()->Set(attr_name, v);
|
||||
}
|
||||
|
@ -170,7 +170,6 @@ cc_library_with_android_deps(
|
||||
"//tensorflow/core:framework",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:protos_all_cc",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -604,7 +603,6 @@ cc_library_with_android_deps(
|
||||
"//tensorflow/core:op_gen_lib",
|
||||
"//tensorflow/core:proto_text",
|
||||
"//tensorflow/core:protos_all_cc",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -624,7 +622,6 @@ tf_cc_test(
|
||||
"//tensorflow/core:protos_all_cc",
|
||||
"//tensorflow/core:test",
|
||||
"//tensorflow/core:test_main",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -686,7 +683,6 @@ tf_cc_binary(
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:protos_all_cc",
|
||||
"//tensorflow/core:tensorflow",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -17,7 +17,6 @@ limitations under the License.
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/cc/framework/cc_op_gen.h"
|
||||
#include "tensorflow/core/framework/api_def.pb.h"
|
||||
#include "tensorflow/core/framework/attr_value.pb.h"
|
||||
@ -108,7 +107,7 @@ string ToTitle(const string& name) {
|
||||
// ABC /// ABC
|
||||
// ///
|
||||
// DEF /// DEF
|
||||
string MakeComment(absl::string_view text, absl::string_view indent) {
|
||||
string MakeComment(StringPiece text, StringPiece indent) {
|
||||
string ret;
|
||||
while (!text.empty()) {
|
||||
int last_non_space = -1;
|
||||
@ -303,9 +302,9 @@ string ToCamelCase(const string& str) {
|
||||
// attr_type when defining an object of that type. The bool is a flag to
|
||||
// indicate whether to treat the type as const when accepting the C++ type as an
|
||||
// argument to a function.
|
||||
std::pair<const char*, bool> AttrTypeName(absl::string_view attr_type) {
|
||||
std::pair<const char*, bool> AttrTypeName(StringPiece attr_type) {
|
||||
static const auto* attr_type_map =
|
||||
new std::unordered_map<absl::string_view, std::pair<const char*, bool>,
|
||||
new std::unordered_map<StringPiece, std::pair<const char*, bool>,
|
||||
StringPieceHasher>{
|
||||
{"string", {"StringPiece", false}},
|
||||
{"list(string)", {"gtl::ArraySlice<string>", true}},
|
||||
@ -332,9 +331,9 @@ std::pair<const char*, bool> AttrTypeName(absl::string_view attr_type) {
|
||||
return entry->second;
|
||||
}
|
||||
|
||||
const char* ListElementTypeName(absl::string_view attr_type) {
|
||||
const char* ListElementTypeName(StringPiece attr_type) {
|
||||
static const auto* attr_list_type_map =
|
||||
new std::unordered_map<absl::string_view, const char*, StringPieceHasher>{
|
||||
new std::unordered_map<StringPiece, const char*, StringPieceHasher>{
|
||||
{"list(string)", "string"},
|
||||
{"list(int)", "int"},
|
||||
{"list(float)", "float"},
|
||||
@ -352,8 +351,8 @@ const char* ListElementTypeName(absl::string_view attr_type) {
|
||||
return entry->second;
|
||||
}
|
||||
|
||||
bool IsCPPKeyword(absl::string_view name) {
|
||||
static const std::unordered_set<absl::string_view, StringPieceHasher>
|
||||
bool IsCPPKeyword(StringPiece name) {
|
||||
static const std::unordered_set<StringPiece, StringPieceHasher>
|
||||
// Keywords obtained from http://en.cppreference.com/w/cpp/keyword
|
||||
kCPPReserved{
|
||||
"alignas",
|
||||
@ -463,7 +462,7 @@ bool IsCPPKeyword(absl::string_view name) {
|
||||
return kCPPReserved.count(name) > 0;
|
||||
}
|
||||
|
||||
string AvoidCPPKeywords(absl::string_view name) {
|
||||
string AvoidCPPKeywords(StringPiece name) {
|
||||
if (IsCPPKeyword(name)) {
|
||||
return strings::StrCat(name, "_");
|
||||
}
|
||||
@ -517,7 +516,7 @@ struct OpInfo {
|
||||
explicit OpInfo(const OpDef& graph_op_def, const ApiDef& api_def,
|
||||
const std::vector<string>& aliases);
|
||||
string GetOpAttrStruct() const;
|
||||
string GetConstructorDecl(absl::string_view op_name_prefix,
|
||||
string GetConstructorDecl(StringPiece op_name_prefix,
|
||||
bool include_attr) const;
|
||||
void WriteClassDecl(WritableFile* h) const;
|
||||
void GetOutput(string* out) const;
|
||||
@ -575,7 +574,7 @@ OpInfo::OpInfo(const OpDef& graph_op_def, const ApiDef& api_def,
|
||||
arg_names.push_back(AvoidCPPKeywords(api_def_arg.rename_to()));
|
||||
|
||||
// TODO(keveman): Include input type information.
|
||||
absl::string_view description = api_def_arg.description();
|
||||
StringPiece description = api_def_arg.description();
|
||||
if (!description.empty()) {
|
||||
ConsumeEquals(&description);
|
||||
strings::StrAppend(&comment, "* ",
|
||||
@ -769,7 +768,7 @@ string OpInfo::GetOpAttrStruct() const {
|
||||
return struct_decl;
|
||||
}
|
||||
|
||||
string OpInfo::GetConstructorDecl(absl::string_view op_name_prefix,
|
||||
string OpInfo::GetConstructorDecl(StringPiece op_name_prefix,
|
||||
bool include_attr) const {
|
||||
const string prefix = strings::StrCat(op_name_prefix, op_name, "(");
|
||||
string c_decl;
|
||||
|
@ -13,11 +13,11 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/cc/framework/cc_op_gen.h"
|
||||
#include "tensorflow/core/framework/op.h"
|
||||
#include "tensorflow/core/framework/op_def.pb.h"
|
||||
#include "tensorflow/core/framework/op_gen_lib.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/lib/io/path.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#include "tensorflow/core/platform/env.h"
|
||||
@ -69,7 +69,7 @@ int main(int argc, char* argv[]) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
bool include_internal = absl::string_view("1") == argv[3];
|
||||
bool include_internal = tensorflow::StringPiece("1") == argv[3];
|
||||
std::vector<tensorflow::string> api_def_dirs = tensorflow::str_util::Split(
|
||||
argv[4], ",", tensorflow::str_util::SkipEmpty());
|
||||
tensorflow::PrintAllCCOps(argv[1], argv[2], include_internal, api_def_dirs);
|
||||
|
@ -15,7 +15,6 @@ limitations under the License.
|
||||
|
||||
#include "tensorflow/cc/framework/cc_op_gen.h"
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/framework/op_def.pb.h"
|
||||
#include "tensorflow/core/framework/op_gen_lib.h"
|
||||
#include "tensorflow/core/lib/core/status_test_util.h"
|
||||
@ -62,12 +61,12 @@ op {
|
||||
}
|
||||
)";
|
||||
|
||||
void ExpectHasSubstr(absl::string_view s, absl::string_view expected) {
|
||||
void ExpectHasSubstr(StringPiece s, StringPiece expected) {
|
||||
EXPECT_TRUE(str_util::StrContains(s, expected))
|
||||
<< "'" << s << "' does not contain '" << expected << "'";
|
||||
}
|
||||
|
||||
void ExpectDoesNotHaveSubstr(absl::string_view s, absl::string_view expected) {
|
||||
void ExpectDoesNotHaveSubstr(StringPiece s, StringPiece expected) {
|
||||
EXPECT_FALSE(str_util::StrContains(s, expected))
|
||||
<< "'" << s << "' contains '" << expected << "'";
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ limitations under the License.
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/cc/framework/scope_internal.h"
|
||||
#include "tensorflow/core/common_runtime/shape_refiner.h"
|
||||
#include "tensorflow/core/framework/node_def_util.h"
|
||||
@ -248,7 +247,7 @@ std::unordered_set<string> Scope::Impl::GetColocationConstraints(
|
||||
std::vector<string> node_constraints;
|
||||
if (GetNodeAttr(attrs, kColocationAttrName, &node_constraints).ok()) {
|
||||
for (const string& entry : node_constraints) {
|
||||
absl::string_view s(entry);
|
||||
StringPiece s(entry);
|
||||
if (str_util::ConsumePrefix(&s, kColocationGroupPrefix)) {
|
||||
current_constraints.emplace(s);
|
||||
}
|
||||
|
@ -95,7 +95,6 @@ cc_library(
|
||||
deps = [
|
||||
":constants",
|
||||
":reader",
|
||||
"@com_google_absl//absl/strings",
|
||||
] + if_not_mobile([
|
||||
"//tensorflow/core:core_cpu",
|
||||
"//tensorflow/core:framework",
|
||||
|
@ -17,7 +17,6 @@ limitations under the License.
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/cc/saved_model/constants.h"
|
||||
#include "tensorflow/cc/saved_model/reader.h"
|
||||
#include "tensorflow/core/lib/io/path.h"
|
||||
@ -61,7 +60,7 @@ Tensor CreateStringTensor(const string& value) {
|
||||
return tensor;
|
||||
}
|
||||
|
||||
void AddAssetsTensorsToInputs(const absl::string_view export_dir,
|
||||
void AddAssetsTensorsToInputs(const StringPiece export_dir,
|
||||
const std::vector<AssetFileDef>& asset_file_defs,
|
||||
std::vector<std::pair<string, Tensor>>* inputs) {
|
||||
if (asset_file_defs.empty()) {
|
||||
@ -148,8 +147,7 @@ Status RunMainOp(const RunOptions& run_options, const string& export_dir,
|
||||
std::vector<std::pair<string, Tensor>> inputs;
|
||||
AddAssetsTensorsToInputs(export_dir, asset_file_defs, &inputs);
|
||||
RunMetadata run_metadata;
|
||||
const absl::string_view main_op_name =
|
||||
main_op_it->second.node_list().value(0);
|
||||
const StringPiece main_op_name = main_op_it->second.node_list().value(0);
|
||||
return RunOnce(run_options, inputs, {}, {string(main_op_name)},
|
||||
nullptr /* outputs */, &run_metadata, session);
|
||||
}
|
||||
@ -157,8 +155,8 @@ Status RunMainOp(const RunOptions& run_options, const string& export_dir,
|
||||
}
|
||||
|
||||
Status RunRestore(const RunOptions& run_options, const string& export_dir,
|
||||
const absl::string_view restore_op_name,
|
||||
const absl::string_view variable_filename_const_op_name,
|
||||
const StringPiece restore_op_name,
|
||||
const StringPiece variable_filename_const_op_name,
|
||||
const std::vector<AssetFileDef>& asset_file_defs,
|
||||
Session* session) {
|
||||
LOG(INFO) << "Restoring SavedModel bundle.";
|
||||
|
@ -18,7 +18,6 @@ limitations under the License.
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/cc/ops/standard_ops.h"
|
||||
#include "tensorflow/core/framework/graph.pb.h"
|
||||
#include "tensorflow/core/framework/tensor.h"
|
||||
@ -166,7 +165,8 @@ void ConcurrentSessions(const Options& opts) {
|
||||
|
||||
namespace {
|
||||
|
||||
bool ParseInt32Flag(absl::string_view arg, absl::string_view flag, int32* dst) {
|
||||
bool ParseInt32Flag(tensorflow::StringPiece arg, tensorflow::StringPiece flag,
|
||||
int32* dst) {
|
||||
if (tensorflow::str_util::ConsumePrefix(&arg, flag) &&
|
||||
tensorflow::str_util::ConsumePrefix(&arg, "=")) {
|
||||
char extra;
|
||||
@ -176,7 +176,8 @@ bool ParseInt32Flag(absl::string_view arg, absl::string_view flag, int32* dst) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ParseBoolFlag(absl::string_view arg, absl::string_view flag, bool* dst) {
|
||||
bool ParseBoolFlag(tensorflow::StringPiece arg, tensorflow::StringPiece flag,
|
||||
bool* dst) {
|
||||
if (tensorflow::str_util::ConsumePrefix(&arg, flag)) {
|
||||
if (arg.empty()) {
|
||||
*dst = true;
|
||||
|
@ -18,7 +18,6 @@ limitations under the License.
|
||||
#include "absl/container/flat_hash_set.h"
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/compiler/jit/encapsulate_subgraphs_pass.h"
|
||||
#include "tensorflow/compiler/tf2xla/dump_graph.h"
|
||||
#include "tensorflow/compiler/xla/status_macros.h"
|
||||
@ -124,8 +123,8 @@ Status RewriteSubgraph(const std::vector<OutputTensor>& arg_source_tensors,
|
||||
bool a_is_resource = (a->output_type(0) == DT_RESOURCE);
|
||||
bool b_is_resource = (b->output_type(0) == DT_RESOURCE);
|
||||
// Uses the name as a tiebreaker so the output is deterministic.
|
||||
absl::string_view a_name(a->name());
|
||||
absl::string_view b_name(b->name());
|
||||
StringPiece a_name(a->name());
|
||||
StringPiece b_name(b->name());
|
||||
return std::tie(a_is_resource, a_name) < std::tie(b_is_resource, b_name);
|
||||
});
|
||||
|
||||
|
@ -194,7 +194,6 @@ cc_library(
|
||||
"//tensorflow/core/kernels:bounds_check",
|
||||
"//tensorflow/core/kernels:conv_ops",
|
||||
"//tensorflow/core/kernels:ops_util",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/types:span",
|
||||
],
|
||||
)
|
||||
|
@ -16,7 +16,6 @@ limitations under the License.
|
||||
// XLA-specific Ops for 2D convolution.
|
||||
|
||||
#include "tensorflow/compiler/tf2xla/kernels/conv_op_helpers.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/types/span.h"
|
||||
#include "tensorflow/compiler/tf2xla/shape_util.h"
|
||||
#include "tensorflow/compiler/tf2xla/type_util.h"
|
||||
@ -199,11 +198,10 @@ Status CheckConvAttrs(const ConvOpAttrs& attrs) {
|
||||
// Wrapper around ConvBackpropComputeDimensions that converts from XLA shapes
|
||||
// to TensorShapes.
|
||||
Status ConvBackpropComputeDimensionsV2XlaShapes(
|
||||
absl::string_view label, int num_spatial_dims,
|
||||
const xla::Shape& input_shape, const xla::Shape& filter_shape,
|
||||
const xla::Shape& out_backprop_shape, absl::Span<const int32> dilations,
|
||||
const std::vector<int32>& strides, Padding padding,
|
||||
TensorFormat data_format, ConvBackpropDimensions* dims) {
|
||||
StringPiece label, int num_spatial_dims, const xla::Shape& input_shape,
|
||||
const xla::Shape& filter_shape, const xla::Shape& out_backprop_shape,
|
||||
absl::Span<const int32> dilations, const std::vector<int32>& strides,
|
||||
Padding padding, TensorFormat data_format, ConvBackpropDimensions* dims) {
|
||||
TensorShape input_tensor_shape, filter_tensor_shape,
|
||||
out_backprop_tensor_shape;
|
||||
TF_RETURN_IF_ERROR(XLAShapeToTensorShape(input_shape, &input_tensor_shape));
|
||||
@ -237,9 +235,10 @@ xla::StatusOr<ConvOpAttrs> ConvOpAttrs::Create(int num_spatial_dims,
|
||||
return attrs;
|
||||
}
|
||||
|
||||
xla::StatusOr<xla::XlaOp> MakeXlaForwardConvOp(
|
||||
absl::string_view /*type_string*/, xla::XlaOp conv_input, xla::XlaOp filter,
|
||||
const ConvOpAttrs& attrs) {
|
||||
xla::StatusOr<xla::XlaOp> MakeXlaForwardConvOp(StringPiece /*type_string*/,
|
||||
xla::XlaOp conv_input,
|
||||
xla::XlaOp filter,
|
||||
const ConvOpAttrs& attrs) {
|
||||
TF_RETURN_IF_ERROR(CheckConvAttrs(attrs));
|
||||
|
||||
auto* builder = conv_input.builder();
|
||||
@ -310,8 +309,8 @@ xla::StatusOr<xla::XlaOp> MakeXlaForwardConvOp(
|
||||
}
|
||||
|
||||
xla::StatusOr<xla::XlaOp> MakeXlaBackpropInputConvOp(
|
||||
absl::string_view type_string, const xla::Shape& input_shape,
|
||||
xla::XlaOp filter, xla::XlaOp out_backprop, const ConvOpAttrs& attrs) {
|
||||
StringPiece type_string, const xla::Shape& input_shape, xla::XlaOp filter,
|
||||
xla::XlaOp out_backprop, const ConvOpAttrs& attrs) {
|
||||
TF_RETURN_IF_ERROR(CheckConvAttrs(attrs));
|
||||
|
||||
int num_dims = attrs.num_spatial_dims + 2;
|
||||
@ -381,7 +380,7 @@ xla::StatusOr<xla::XlaOp> MakeXlaBackpropInputConvOp(
|
||||
}
|
||||
|
||||
xla::StatusOr<xla::XlaOp> MakeXlaBackpropFilterConvOp(
|
||||
absl::string_view type_string, xla::XlaOp activations,
|
||||
StringPiece type_string, xla::XlaOp activations,
|
||||
const xla::Shape& filter_shape, xla::XlaOp gradients,
|
||||
const ConvOpAttrs& attrs) {
|
||||
TF_RETURN_IF_ERROR(CheckConvAttrs(attrs));
|
||||
|
@ -18,7 +18,6 @@ limitations under the License.
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/compiler/xla/client/xla_builder.h"
|
||||
#include "tensorflow/compiler/xla/statusor.h"
|
||||
#include "tensorflow/core/framework/op_kernel.h"
|
||||
@ -53,15 +52,15 @@ struct ConvOpAttrs {
|
||||
|
||||
// Creates a new XLA forward or backward convolution with the given inputs and
|
||||
// attributes.
|
||||
xla::StatusOr<xla::XlaOp> MakeXlaForwardConvOp(absl::string_view type_string,
|
||||
xla::StatusOr<xla::XlaOp> MakeXlaForwardConvOp(StringPiece type_string,
|
||||
xla::XlaOp conv_input,
|
||||
xla::XlaOp filter,
|
||||
const ConvOpAttrs& attrs);
|
||||
xla::StatusOr<xla::XlaOp> MakeXlaBackpropInputConvOp(
|
||||
absl::string_view type_string, const xla::Shape& input_shape,
|
||||
xla::XlaOp filter, xla::XlaOp out_backprop, const ConvOpAttrs& attrs);
|
||||
StringPiece type_string, const xla::Shape& input_shape, xla::XlaOp filter,
|
||||
xla::XlaOp out_backprop, const ConvOpAttrs& attrs);
|
||||
xla::StatusOr<xla::XlaOp> MakeXlaBackpropFilterConvOp(
|
||||
absl::string_view type_string, xla::XlaOp activations,
|
||||
StringPiece type_string, xla::XlaOp activations,
|
||||
const xla::Shape& filter_shape, xla::XlaOp gradients,
|
||||
const ConvOpAttrs& attrs);
|
||||
|
||||
|
@ -67,8 +67,8 @@ int main(int argc, char** argv) {
|
||||
floats.push_back(value);
|
||||
}
|
||||
|
||||
absl::string_view content(absl::bit_cast<const char*>(floats.data()),
|
||||
floats.size() * sizeof(float));
|
||||
tensorflow::StringPiece content(absl::bit_cast<const char*>(floats.data()),
|
||||
floats.size() * sizeof(float));
|
||||
TF_CHECK_OK(tensorflow::WriteStringToFile(tensorflow::Env::Default(),
|
||||
output_file, content));
|
||||
return 0;
|
||||
|
@ -17,7 +17,6 @@ limitations under the License.
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#include "tensorflow/core/platform/env.h"
|
||||
#include "tensorflow/core/platform/file_system_helper.h"
|
||||
@ -27,7 +26,7 @@ namespace {
|
||||
|
||||
string RemoveSuffix(const string& name, const string& suffix) {
|
||||
string output(name);
|
||||
absl::string_view piece(output);
|
||||
StringPiece piece(output);
|
||||
str_util::ConsumeSuffix(&piece, suffix);
|
||||
return string(piece);
|
||||
}
|
||||
@ -88,7 +87,7 @@ class RandomAccessFileFromAsset : public RandomAccessFile {
|
||||
: asset_manager_(asset_manager), file_name_(name) {}
|
||||
~RandomAccessFileFromAsset() override = default;
|
||||
|
||||
Status Read(uint64 offset, size_t to_read, absl::string_view* result,
|
||||
Status Read(uint64 offset, size_t to_read, StringPiece* result,
|
||||
char* scratch) const override {
|
||||
auto asset = ScopedAsset(AAssetManager_open(
|
||||
asset_manager_, file_name_.c_str(), AASSET_MODE_RANDOM));
|
||||
@ -99,7 +98,7 @@ class RandomAccessFileFromAsset : public RandomAccessFile {
|
||||
off64_t new_offset = AAsset_seek64(asset.get(), offset, SEEK_SET);
|
||||
off64_t length = AAsset_getLength64(asset.get());
|
||||
if (new_offset < 0) {
|
||||
*result = absl::string_view(scratch, 0);
|
||||
*result = StringPiece(scratch, 0);
|
||||
return errors::OutOfRange("Read after file end.");
|
||||
}
|
||||
const off64_t region_left =
|
||||
@ -108,7 +107,7 @@ class RandomAccessFileFromAsset : public RandomAccessFile {
|
||||
if (read < 0) {
|
||||
return errors::Internal("Error reading from asset.");
|
||||
}
|
||||
*result = absl::string_view(scratch, region_left);
|
||||
*result = StringPiece(scratch, region_left);
|
||||
return (region_left == to_read)
|
||||
? Status::OK()
|
||||
: errors::OutOfRange("Read less bytes than requested.");
|
||||
@ -230,7 +229,7 @@ string AssetManagerFileSystem::NormalizeDirectoryPath(const string& fname) {
|
||||
}
|
||||
|
||||
string AssetManagerFileSystem::RemoveAssetPrefix(const string& name) {
|
||||
absl::string_view piece(name);
|
||||
StringPiece piece(name);
|
||||
str_util::ConsumePrefix(&piece, prefix_);
|
||||
return string(piece);
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/contrib/bigtable/kernels/bigtable_lib.h"
|
||||
|
||||
#include "tensorflow/core/framework/op_kernel.h"
|
||||
@ -343,8 +342,7 @@ class ToBigtableOp : public AsyncOpKernel {
|
||||
|
||||
template <typename T>
|
||||
Status ParseScalarArgument(OpKernelContext* ctx,
|
||||
const absl::string_view& argument_name,
|
||||
T* output) {
|
||||
const StringPiece& argument_name, T* output) {
|
||||
const Tensor* argument_t;
|
||||
TF_RETURN_IF_ERROR(ctx->input(argument_name, &argument_t));
|
||||
if (!TensorShapeUtils::IsScalar(argument_t->shape())) {
|
||||
|
@ -15,7 +15,6 @@ limitations under the License.
|
||||
|
||||
#include "tensorflow/contrib/bigtable/kernels/bigtable_range_helpers.h"
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
|
||||
namespace tensorflow {
|
||||
@ -56,11 +55,11 @@ const string& MultiModeKeyRange::begin_key() const { return begin_; }
|
||||
|
||||
const string& MultiModeKeyRange::end_key() const { return end_; }
|
||||
|
||||
bool MultiModeKeyRange::contains_key(absl::string_view key) const {
|
||||
if (absl::string_view(begin_) > key) {
|
||||
bool MultiModeKeyRange::contains_key(StringPiece key) const {
|
||||
if (StringPiece(begin_) > key) {
|
||||
return false;
|
||||
}
|
||||
if (absl::string_view(end_) <= key && !end_.empty()) {
|
||||
if (StringPiece(end_) <= key && !end_.empty()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -18,7 +18,7 @@ limitations under the License.
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/platform/types.h"
|
||||
|
||||
namespace tensorflow {
|
||||
@ -52,7 +52,7 @@ class MultiModeKeyRange {
|
||||
// The first invalid key after the valid range.
|
||||
const string& end_key() const;
|
||||
// Returns true if the provided key is a part of the range, false otherwise.
|
||||
bool contains_key(absl::string_view key) const;
|
||||
bool contains_key(StringPiece key) const;
|
||||
|
||||
private:
|
||||
MultiModeKeyRange(string begin, string end)
|
||||
|
@ -46,7 +46,6 @@ cc_library(
|
||||
"//tensorflow/core:protos_all_cc",
|
||||
"//tensorflow/core/platform/cloud:curl_http_request",
|
||||
"//tensorflow/core/platform/cloud:google_auth_provider",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
alwayslink = 1,
|
||||
)
|
||||
@ -66,7 +65,6 @@ tf_cc_test(
|
||||
"//tensorflow/core:test",
|
||||
"//tensorflow/core:test_main",
|
||||
"//tensorflow/core/platform/cloud:http_request_fake",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -87,7 +85,6 @@ tf_kernel_library(
|
||||
"//tensorflow/core/platform/cloud:curl_http_request",
|
||||
"//tensorflow/core/platform/cloud:gcs_file_system",
|
||||
"//tensorflow/core/platform/cloud:oauth_client",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@jsoncpp_git//:jsoncpp",
|
||||
],
|
||||
)
|
||||
|
@ -14,7 +14,6 @@ limitations under the License.
|
||||
==============================================================================*/
|
||||
#include "tensorflow/contrib/cloud/kernels/bigquery_table_accessor.h"
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/example/feature.pb.h"
|
||||
#include "tensorflow/core/lib/strings/numbers.h"
|
||||
|
||||
@ -32,7 +31,7 @@ bool IsPartitionEmpty(const BigQueryTablePartition& partition) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Status ParseJson(absl::string_view json, Json::Value* result) {
|
||||
Status ParseJson(StringPiece json, Json::Value* result) {
|
||||
Json::Reader reader;
|
||||
if (!reader.parse(string(json), *result)) {
|
||||
return errors::Internal("Couldn't parse JSON response from BigQuery.");
|
||||
@ -184,8 +183,8 @@ Status BigQueryTableAccessor::ReadRow(int64* row_id, Example* example) {
|
||||
FullTableName());
|
||||
|
||||
// Parse the returned row.
|
||||
absl::string_view response_piece =
|
||||
absl::string_view(&output_buffer[0], output_buffer.size());
|
||||
StringPiece response_piece =
|
||||
StringPiece(&output_buffer[0], output_buffer.size());
|
||||
Json::Value root;
|
||||
TF_RETURN_IF_ERROR(ParseJson(response_piece, &root));
|
||||
for (unsigned int i = 0; i < root["rows"].size(); ++i) {
|
||||
@ -262,8 +261,8 @@ Status BigQueryTableAccessor::ReadSchema() {
|
||||
FullTableName());
|
||||
|
||||
// Parse the schema.
|
||||
absl::string_view response_piece =
|
||||
absl::string_view(&output_buffer[0], output_buffer.size());
|
||||
StringPiece response_piece =
|
||||
StringPiece(&output_buffer[0], output_buffer.size());
|
||||
|
||||
Json::Value root;
|
||||
TF_RETURN_IF_ERROR(ParseJson(response_piece, &root));
|
||||
|
@ -14,7 +14,6 @@ limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#include "tensorflow/contrib/cloud/kernels/bigquery_table_accessor.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/contrib/cloud/kernels/bigquery_table_accessor_test_data.h"
|
||||
#include "tensorflow/core/example/feature.pb.h"
|
||||
#include "tensorflow/core/lib/core/status_test_util.h"
|
||||
@ -30,7 +29,7 @@ constexpr char kTestProject[] = "test-project";
|
||||
constexpr char kTestDataset[] = "test-dataset";
|
||||
constexpr char kTestTable[] = "test-table";
|
||||
|
||||
bool HasSubstr(absl::string_view base, absl::string_view substr) {
|
||||
bool HasSubstr(StringPiece base, StringPiece substr) {
|
||||
bool ok = str_util::StrContains(base, substr);
|
||||
EXPECT_TRUE(ok) << base << ", expected substring " << substr;
|
||||
return ok;
|
||||
|
@ -15,7 +15,6 @@ limitations under the License.
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "include/json/json.h"
|
||||
#include "tensorflow/core/framework/op_kernel.h"
|
||||
#include "tensorflow/core/framework/tensor_shape.h"
|
||||
@ -64,8 +63,8 @@ Status RetrieveGcsFs(OpKernelContext* ctx, RetryingGcsFileSystem** fs) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
Status ParseScalarArgument(OpKernelContext* ctx,
|
||||
absl::string_view argument_name, T* output) {
|
||||
Status ParseScalarArgument(OpKernelContext* ctx, StringPiece argument_name,
|
||||
T* output) {
|
||||
const Tensor* argument_t;
|
||||
TF_RETURN_IF_ERROR(ctx->input(argument_name, &argument_t));
|
||||
if (!TensorShapeUtils::IsScalar(argument_t->shape())) {
|
||||
|
@ -29,7 +29,6 @@ cc_library(
|
||||
"//tensorflow/contrib/ffmpeg/default:ffmpeg_lib",
|
||||
"//tensorflow/core:framework_headers_lib",
|
||||
"//third_party/eigen3",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
alwayslink = 1,
|
||||
)
|
||||
@ -58,7 +57,6 @@ cc_library(
|
||||
"//tensorflow/contrib/ffmpeg/default:ffmpeg_lib",
|
||||
"//tensorflow/core:framework_headers_lib",
|
||||
"//third_party/eigen3",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
alwayslink = 1,
|
||||
)
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include <cstdio>
|
||||
#include <set>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/contrib/ffmpeg/ffmpeg_lib.h"
|
||||
#include "tensorflow/core/framework/op.h"
|
||||
#include "tensorflow/core/framework/op_kernel.h"
|
||||
@ -42,7 +41,8 @@ const char* kValidFileFormats[] = {"mp3", "mp4", "ogg", "wav"};
|
||||
* Decoding implementation, shared across V1 and V2 ops. Creates a new
|
||||
* output in the context.
|
||||
*/
|
||||
void Decode(OpKernelContext* context, const absl::string_view& file_contents,
|
||||
void Decode(OpKernelContext* context,
|
||||
const tensorflow::StringPiece& file_contents,
|
||||
const string& file_format, const int32 samples_per_second,
|
||||
const int32 channel_count, const string& stream) {
|
||||
// Write the input data to a temp file.
|
||||
@ -135,7 +135,7 @@ class DecodeAudioOpV2 : public OpKernel {
|
||||
"channel_count must be a rank-0 tensor but got shape ",
|
||||
channel_count_tensor.shape().DebugString()));
|
||||
|
||||
const absl::string_view contents = contents_tensor.scalar<string>()();
|
||||
const tensorflow::StringPiece contents = contents_tensor.scalar<string>()();
|
||||
const string file_format =
|
||||
str_util::Lowercase(file_format_tensor.scalar<string>()());
|
||||
const int32 samples_per_second =
|
||||
@ -245,7 +245,7 @@ class DecodeAudioOp : public OpKernel {
|
||||
errors::InvalidArgument("contents must be scalar but got shape ",
|
||||
contents.shape().DebugString()));
|
||||
|
||||
const absl::string_view file_contents = contents.scalar<string>()();
|
||||
const tensorflow::StringPiece file_contents = contents.scalar<string>()();
|
||||
Decode(context, file_contents, file_format_, samples_per_second_,
|
||||
channel_count_, "");
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include <cstdio>
|
||||
#include <set>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/contrib/ffmpeg/ffmpeg_lib.h"
|
||||
#include "tensorflow/core/framework/op.h"
|
||||
#include "tensorflow/core/framework/op_kernel.h"
|
||||
@ -46,7 +45,7 @@ class DecodeVideoOp : public OpKernel {
|
||||
errors::InvalidArgument(
|
||||
"contents must be a rank-0 tensor but got shape ",
|
||||
contents_tensor.shape().DebugString()));
|
||||
const absl::string_view contents = contents_tensor.scalar<string>()();
|
||||
const tensorflow::StringPiece contents = contents_tensor.scalar<string>()();
|
||||
|
||||
// Write the input data to a temp file.
|
||||
string extension;
|
||||
|
@ -20,7 +20,6 @@ cc_library(
|
||||
deps = [
|
||||
"//tensorflow/core:framework_headers_lib",
|
||||
"//third_party/eigen3",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@protobuf_archive//:protobuf_headers",
|
||||
],
|
||||
)
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/lib/io/path.h"
|
||||
#include "tensorflow/core/lib/strings/numbers.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
@ -304,7 +303,7 @@ FileDeleter::~FileDeleter() {
|
||||
env.DeleteFile(filename_).IgnoreError();
|
||||
}
|
||||
|
||||
Status WriteFile(const string& filename, absl::string_view contents) {
|
||||
Status WriteFile(const string& filename, StringPiece contents) {
|
||||
Env& env = *Env::Default();
|
||||
std::unique_ptr<WritableFile> file;
|
||||
TF_RETURN_IF_ERROR(env.NewWritableFile(filename, &file));
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/lib/core/status.h"
|
||||
|
||||
namespace tensorflow {
|
||||
@ -36,7 +35,7 @@ class FileDeleter {
|
||||
};
|
||||
|
||||
// Writes binary data to a file.
|
||||
Status WriteFile(const string& filename, absl::string_view contents);
|
||||
Status WriteFile(const string& filename, tensorflow::StringPiece contents);
|
||||
|
||||
// Reads an audio file using ffmpeg and converts it into an array of samples in
|
||||
// [-1.0, 1.0]. If there are multiple channels in the audio then each frame will
|
||||
|
@ -97,7 +97,6 @@ cc_library(
|
||||
"//tensorflow/core/distributed_runtime:worker_cache",
|
||||
"//tensorflow/core/distributed_runtime:worker_env",
|
||||
"//tensorflow/core/distributed_runtime:worker_interface",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -16,7 +16,6 @@ limitations under the License.
|
||||
#include "tensorflow/contrib/gdr/gdr_rendezvous_mgr.h"
|
||||
|
||||
#include "google/protobuf/any.pb.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/contrib/gdr/gdr_memory_manager.h"
|
||||
#include "tensorflow/core/common_runtime/device.h"
|
||||
#include "tensorflow/core/common_runtime/device_mgr.h"
|
||||
@ -42,7 +41,7 @@ class GdrRecvTensorCall : public BaseRecvTensorCall {
|
||||
GdrRecvTensorCall(WorkerInterface* wi, Device* dst_device,
|
||||
RemoteMemoryManager* remote_memory_manager,
|
||||
const Rendezvous::Args& recv_args, int64 step_id,
|
||||
absl::string_view key)
|
||||
StringPiece key)
|
||||
: wi_(wi),
|
||||
dst_device_(dst_device),
|
||||
remote_memory_manager_(remote_memory_manager),
|
||||
|
@ -13,7 +13,6 @@ cc_library(
|
||||
deps = [
|
||||
"//tensorflow/core:framework_headers_lib",
|
||||
"//third_party/eigen3",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@farmhash_archive//:farmhash",
|
||||
"@protobuf_archive//:protobuf_headers",
|
||||
],
|
||||
|
@ -19,7 +19,6 @@ limitations under the License.
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor"
|
||||
#include "tensorflow/core/framework/kernel_def_builder.h"
|
||||
#include "tensorflow/core/framework/op_def_builder.h"
|
||||
@ -27,6 +26,7 @@ limitations under the License.
|
||||
#include "tensorflow/core/framework/tensor.h"
|
||||
#include "tensorflow/core/framework/tensor_shape.h"
|
||||
#include "tensorflow/core/framework/types.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#include "tensorflow/core/platform/fingerprint.h"
|
||||
#include "tensorflow/core/util/work_sharder.h"
|
||||
@ -92,8 +92,8 @@ string SparseTensorColumn<string>::Feature(int64 batch, int64 n) const {
|
||||
}
|
||||
|
||||
template <>
|
||||
absl::string_view SparseTensorColumn<absl::string_view>::Feature(
|
||||
int64 batch, int64 n) const {
|
||||
StringPiece SparseTensorColumn<StringPiece>::Feature(int64 batch,
|
||||
int64 n) const {
|
||||
const int64 start = feature_start_indices_[batch];
|
||||
return values_.vec<string>().data()[start + n];
|
||||
}
|
||||
@ -130,8 +130,8 @@ string DenseTensorColumn<string>::Feature(int64 batch, int64 n) const {
|
||||
}
|
||||
|
||||
template <>
|
||||
absl::string_view DenseTensorColumn<absl::string_view>::Feature(int64 batch,
|
||||
int64 n) const {
|
||||
StringPiece DenseTensorColumn<StringPiece>::Feature(int64 batch,
|
||||
int64 n) const {
|
||||
return tensor_.matrix<string>()(batch, n);
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/framework/op_kernel.h"
|
||||
#include "tensorflow/core/framework/tensor.h"
|
||||
#include "tensorflow/core/framework/tensor_shape.h"
|
||||
@ -47,10 +46,10 @@ class DecodeLibsvmOp : public OpKernel {
|
||||
std::vector<T> out_values;
|
||||
std::vector<std::pair<int64, int64>> out_indices;
|
||||
for (int i = 0; i < input_flat.size(); ++i) {
|
||||
absl::string_view line(input_flat(i));
|
||||
StringPiece line(input_flat(i));
|
||||
str_util::RemoveWhitespaceContext(&line);
|
||||
|
||||
absl::string_view piece;
|
||||
StringPiece piece;
|
||||
OP_REQUIRES(ctx, str_util::ConsumeNonWhitespace(&line, &piece),
|
||||
errors::InvalidArgument("No label found for input[", i,
|
||||
"]: \"", input_flat(i), "\""));
|
||||
@ -65,7 +64,7 @@ class DecodeLibsvmOp : public OpKernel {
|
||||
str_util::RemoveLeadingWhitespace(&line);
|
||||
while (str_util::ConsumeNonWhitespace(&line, &piece)) {
|
||||
size_t p = piece.find(':');
|
||||
OP_REQUIRES(ctx, (p != absl::string_view::npos),
|
||||
OP_REQUIRES(ctx, (p != StringPiece::npos),
|
||||
errors::InvalidArgument("Invalid feature \"", piece, "\""));
|
||||
|
||||
int64 feature_index;
|
||||
|
@ -79,7 +79,6 @@ cc_library(
|
||||
":delegate_data",
|
||||
":kernel",
|
||||
":util",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//tensorflow/contrib/lite/c:c_api_internal",
|
||||
"//tensorflow/contrib/lite:kernel_api",
|
||||
"//tensorflow/contrib/lite:util",
|
||||
@ -177,7 +176,6 @@ tf_cc_test(
|
||||
":kernel",
|
||||
":test_util",
|
||||
"@com_google_googletest//:gtest",
|
||||
"@com_google_absl//absl/strings",
|
||||
] + select({
|
||||
"//tensorflow:android": [
|
||||
"//tensorflow/core:android_tensorflow_lib",
|
||||
|
@ -16,7 +16,6 @@ limitations under the License.
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/contrib/lite/context_util.h"
|
||||
#include "tensorflow/contrib/lite/delegates/flex/buffer_map.h"
|
||||
#include "tensorflow/contrib/lite/delegates/flex/kernel.h"
|
||||
@ -69,7 +68,7 @@ TfLiteStatus CopyFromBufferHandle(TfLiteContext* context,
|
||||
}
|
||||
|
||||
tensorflow::Tensor t = buffer_map->GetTensor(buffer_handle);
|
||||
absl::string_view t_data = t.tensor_data();
|
||||
tensorflow::StringPiece t_data = t.tensor_data();
|
||||
|
||||
if (size != t_data.size()) {
|
||||
context->ReportError(
|
||||
|
@ -16,7 +16,6 @@ limitations under the License.
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/contrib/lite/delegates/flex/delegate_data.h"
|
||||
#include "tensorflow/contrib/lite/delegates/flex/test_util.h"
|
||||
|
||||
@ -61,9 +60,9 @@ class KernelTest : public testing::FlexModelTest {
|
||||
TfLiteBufferHandle buffer_handle,
|
||||
void* data, size_t size) {
|
||||
auto* delegate_data = reinterpret_cast<DelegateData*>(delegate->data_);
|
||||
absl::string_view values = delegate_data->GetBufferMap(context)
|
||||
->GetTensor(buffer_handle)
|
||||
.tensor_data();
|
||||
tensorflow::StringPiece values = delegate_data->GetBufferMap(context)
|
||||
->GetTensor(buffer_handle)
|
||||
.tensor_data();
|
||||
memcpy(data, values.data(), values.size());
|
||||
return kTfLiteOk;
|
||||
};
|
||||
|
@ -13,7 +13,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#if GOOGLE_CUDA
|
||||
|
||||
@ -36,7 +35,7 @@ Status ReplaceReduce(Graph* graph, Node* node) {
|
||||
TF_RETURN_IF_ERROR(GetNodeAttr(node->attrs(), "T", &dtype));
|
||||
int num_devices = node->num_inputs();
|
||||
string shared_name = node->name();
|
||||
auto make_builder = [&](absl::string_view op_name, absl::string_view suffix) {
|
||||
auto make_builder = [&](StringPiece op_name, StringPiece suffix) {
|
||||
return NodeBuilder(strings::StrCat(shared_name, suffix), op_name)
|
||||
.Attr("reduction", reduction)
|
||||
.Attr("num_devices", num_devices)
|
||||
@ -160,7 +159,7 @@ Status ReplaceBroadcast(Graph* graph, Node* node) {
|
||||
}
|
||||
|
||||
string shared_name = node->name();
|
||||
auto make_builder = [&](absl::string_view op_name, absl::string_view suffix) {
|
||||
auto make_builder = [&](StringPiece op_name, StringPiece suffix) {
|
||||
return NodeBuilder(strings::StrCat(shared_name, suffix), op_name)
|
||||
.Attr("num_devices", num_devices)
|
||||
.Attr("shared_name", shared_name)
|
||||
@ -256,7 +255,7 @@ class NcclReplacePass : public GraphOptimizationPass {
|
||||
}
|
||||
// Find reduction and broadcast ops and replace them with Send/Recv ops.
|
||||
for (Node* node : graph->op_nodes()) {
|
||||
absl::string_view type = node->type_string();
|
||||
StringPiece type = node->type_string();
|
||||
if (!str_util::StartsWith(type, "Nccl")) {
|
||||
continue;
|
||||
}
|
||||
|
@ -35,7 +35,6 @@ cc_library(
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:lib_proto_parsing",
|
||||
"//tensorflow/core:protos_all_cc",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -15,17 +15,17 @@ limitations under the License.
|
||||
|
||||
#include "tensorflow/contrib/saved_model/cc/saved_model/signature_def_utils.h"
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/cc/saved_model/signature_constants.h"
|
||||
#include "tensorflow/core/framework/types.pb.h"
|
||||
#include "tensorflow/core/lib/core/errors.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/platform/protobuf.h"
|
||||
|
||||
namespace tensorflow {
|
||||
|
||||
namespace {
|
||||
template <class T>
|
||||
Status FindInProtobufMap(absl::string_view description,
|
||||
Status FindInProtobufMap(StringPiece description,
|
||||
const protobuf::Map<string, T>& map, const string& key,
|
||||
const T** value) {
|
||||
const auto it = map.find(key);
|
||||
|
@ -190,7 +190,6 @@ cc_library(
|
||||
"//tensorflow/core:core_cpu",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:protos_all_cc",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -207,7 +206,6 @@ cc_library(
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":signature_lite",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//tensorflow/core:lib_internal",
|
||||
] + if_not_mobile([
|
||||
":manifest_proto_cc",
|
||||
@ -344,7 +342,6 @@ tf_cc_test(
|
||||
"//tensorflow/core:test",
|
||||
"//tensorflow/core:test_main",
|
||||
"//tensorflow/core:testlib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -373,7 +370,6 @@ cc_library(
|
||||
deps = [
|
||||
":session_bundle",
|
||||
":signature",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//tensorflow/cc/saved_model:loader",
|
||||
"//tensorflow/cc/saved_model:signature_constants",
|
||||
] + if_not_mobile([
|
||||
|
@ -15,7 +15,6 @@ limitations under the License.
|
||||
|
||||
#include "tensorflow/contrib/session_bundle/bundle_shim.h"
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/cc/saved_model/loader.h"
|
||||
#include "tensorflow/cc/saved_model/signature_constants.h"
|
||||
#include "tensorflow/contrib/session_bundle/manifest.pb.h"
|
||||
@ -24,6 +23,7 @@ limitations under the License.
|
||||
#include "tensorflow/core/graph/graph_constructor.h"
|
||||
#include "tensorflow/core/lib/core/errors.h"
|
||||
#include "tensorflow/core/lib/core/status.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/protobuf/meta_graph.pb.h"
|
||||
#include "tensorflow/core/public/session.h"
|
||||
#include "tensorflow/core/public/session_options.h"
|
||||
@ -129,7 +129,7 @@ Status MaybeBuildPredictSignatureDef(
|
||||
|
||||
Status LoadSavedModelFromLegacySessionBundlePath(
|
||||
const SessionOptions& session_options, const RunOptions& run_options,
|
||||
const absl::string_view session_bundle_export_dir,
|
||||
const StringPiece session_bundle_export_dir,
|
||||
SavedModelBundle* saved_model_bundle) {
|
||||
if (session_bundle_export_dir.empty()) {
|
||||
return Status(error::Code::NOT_FOUND, "Export directory path is empty.");
|
||||
|
@ -20,7 +20,6 @@ limitations under the License.
|
||||
#include <vector>
|
||||
|
||||
#include "google/protobuf/any.pb.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/contrib/session_bundle/manifest.pb.h"
|
||||
#include "tensorflow/core/framework/graph.pb.h"
|
||||
#include "tensorflow/core/framework/graph_def_util.h"
|
||||
@ -63,7 +62,7 @@ Status CreateSessionFromGraphDef(const SessionOptions& options,
|
||||
return (*session)->Create(graph);
|
||||
}
|
||||
|
||||
Status GetMetaGraphDefFromExport(const absl::string_view export_dir,
|
||||
Status GetMetaGraphDefFromExport(const StringPiece export_dir,
|
||||
MetaGraphDef* meta_graph_def) {
|
||||
const string meta_graph_def_path =
|
||||
io::JoinPath(export_dir, kMetaGraphDefFilename);
|
||||
@ -78,7 +77,7 @@ Tensor CreateStringTensor(const string& value) {
|
||||
}
|
||||
|
||||
// Adds Assets related tensors (assets_dir and asset files) to the inputs.
|
||||
void AddAssetsTensorsToInputs(const absl::string_view export_dir,
|
||||
void AddAssetsTensorsToInputs(const StringPiece export_dir,
|
||||
const std::vector<AssetFile>& asset_files,
|
||||
std::vector<std::pair<string, Tensor>>* inputs) {
|
||||
if (asset_files.empty()) {
|
||||
@ -109,7 +108,7 @@ void AddAssetsTensorsToInputs(const absl::string_view export_dir,
|
||||
// prefix.data-* are present in the filesystem. So if we see export.index
|
||||
// present in the export_dir, we know the export is in V2 format and we return
|
||||
// <export_dir>/export as this prefix.
|
||||
string GetVariablesFilename(const absl::string_view export_dir) {
|
||||
string GetVariablesFilename(const StringPiece export_dir) {
|
||||
const char kVariablesFilename[] = "export";
|
||||
const string kVariablesIndexFilename = MetaFilename("export"); // V2 ckpts
|
||||
const char kVariablesFilenamePattern[] = "export-\?\?\?\?\?-of-\?\?\?\?\?";
|
||||
@ -129,11 +128,10 @@ string GetVariablesFilename(const absl::string_view export_dir) {
|
||||
}
|
||||
}
|
||||
|
||||
Status RunRestoreOp(const RunOptions& run_options,
|
||||
const absl::string_view export_dir,
|
||||
Status RunRestoreOp(const RunOptions& run_options, const StringPiece export_dir,
|
||||
const std::vector<AssetFile>& asset_files,
|
||||
const absl::string_view restore_op_name,
|
||||
const absl::string_view variables_filename_const_op_name,
|
||||
const StringPiece restore_op_name,
|
||||
const StringPiece variables_filename_const_op_name,
|
||||
Session* session) {
|
||||
LOG(INFO) << "Running restore op for SessionBundle: " << restore_op_name
|
||||
<< ", " << variables_filename_const_op_name;
|
||||
@ -147,10 +145,9 @@ Status RunRestoreOp(const RunOptions& run_options,
|
||||
nullptr /* outputs */, &run_metadata);
|
||||
}
|
||||
|
||||
Status RunInitOp(const RunOptions& run_options,
|
||||
const absl::string_view export_dir,
|
||||
Status RunInitOp(const RunOptions& run_options, const StringPiece export_dir,
|
||||
const std::vector<AssetFile>& asset_files,
|
||||
const absl::string_view init_op_name, Session* session) {
|
||||
const StringPiece init_op_name, Session* session) {
|
||||
LOG(INFO) << "Running init op for SessionBundle";
|
||||
std::vector<std::pair<string, Tensor>> inputs;
|
||||
AddAssetsTensorsToInputs(export_dir, asset_files, &inputs);
|
||||
@ -161,7 +158,7 @@ Status RunInitOp(const RunOptions& run_options,
|
||||
|
||||
Status LoadSessionBundleFromPathUsingRunOptionsInternal(
|
||||
const SessionOptions& options, const RunOptions& run_options,
|
||||
const absl::string_view export_dir, SessionBundle* const bundle) {
|
||||
const StringPiece export_dir, SessionBundle* const bundle) {
|
||||
LOG(INFO) << "Attempting to load a SessionBundle from: " << export_dir;
|
||||
LOG(INFO) << "Using RunOptions: " << DebugStringIfAvailable(run_options);
|
||||
TF_RETURN_IF_ERROR(
|
||||
@ -230,16 +227,17 @@ Status LoadSessionBundleFromPathUsingRunOptionsInternal(
|
||||
} // namespace
|
||||
|
||||
Status LoadSessionBundleFromPath(const SessionOptions& options,
|
||||
const absl::string_view export_dir,
|
||||
const StringPiece export_dir,
|
||||
SessionBundle* const bundle) {
|
||||
TF_RETURN_IF_ERROR(LoadSessionBundleFromPathUsingRunOptions(
|
||||
options, RunOptions(), export_dir, bundle));
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
Status LoadSessionBundleFromPathUsingRunOptions(
|
||||
const SessionOptions& options, const RunOptions& run_options,
|
||||
const absl::string_view export_dir, SessionBundle* const bundle) {
|
||||
Status LoadSessionBundleFromPathUsingRunOptions(const SessionOptions& options,
|
||||
const RunOptions& run_options,
|
||||
const StringPiece export_dir,
|
||||
SessionBundle* const bundle) {
|
||||
const uint64 start_microseconds = Env::Default()->NowMicros();
|
||||
const Status status = LoadSessionBundleFromPathUsingRunOptionsInternal(
|
||||
options, run_options, export_dir, bundle);
|
||||
@ -265,7 +263,7 @@ Status LoadSessionBundleFromPathUsingRunOptions(
|
||||
return status;
|
||||
}
|
||||
|
||||
bool IsPossibleExportDirectory(const absl::string_view directory) {
|
||||
bool IsPossibleExportDirectory(const StringPiece directory) {
|
||||
const string meta_graph_def_path =
|
||||
io::JoinPath(directory, kMetaGraphDefFilename);
|
||||
return Env::Default()->FileExists(meta_graph_def_path).ok();
|
||||
|
@ -20,10 +20,10 @@ limitations under the License.
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/contrib/session_bundle/manifest.pb.h"
|
||||
#include "tensorflow/contrib/session_bundle/signature.h"
|
||||
#include "tensorflow/core/lib/core/status.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/protobuf/meta_graph.pb.h"
|
||||
#include "tensorflow/core/protobuf/saver.pb.h"
|
||||
#include "tensorflow/core/public/session.h"
|
||||
@ -60,7 +60,7 @@ struct SessionBundle {
|
||||
|
||||
// Loads a manifest and initialized session using the output of an Exporter.
|
||||
Status LoadSessionBundleFromPath(const SessionOptions& options,
|
||||
const absl::string_view export_dir,
|
||||
const StringPiece export_dir,
|
||||
SessionBundle* bundle);
|
||||
|
||||
// Similar to the LoadSessionBundleFromPath(), but also allows the session run
|
||||
@ -70,14 +70,14 @@ Status LoadSessionBundleFromPath(const SessionOptions& options,
|
||||
// This method is EXPERIMENTAL and may change or be removed.
|
||||
Status LoadSessionBundleFromPathUsingRunOptions(
|
||||
const SessionOptions& session_options, const RunOptions& run_options,
|
||||
const absl::string_view export_dir, SessionBundle* bundle);
|
||||
const StringPiece export_dir, SessionBundle* bundle);
|
||||
|
||||
// Sanity checks whether the directory looks like an export directory. Note that
|
||||
// we don't try to load any data in this method.
|
||||
//
|
||||
// If the method returns false this is definitely not an export directory, if it
|
||||
// returns true, it is no guarantee that the model will load.
|
||||
bool IsPossibleExportDirectory(const absl::string_view export_dir);
|
||||
bool IsPossibleExportDirectory(const StringPiece export_dir);
|
||||
|
||||
} // namespace serving
|
||||
} // namespace tensorflow
|
||||
|
@ -18,7 +18,6 @@ limitations under the License.
|
||||
#include <memory>
|
||||
|
||||
#include "google/protobuf/any.pb.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/contrib/session_bundle/manifest.pb.h"
|
||||
#include "tensorflow/core/framework/graph.pb.h"
|
||||
#include "tensorflow/core/framework/tensor.h"
|
||||
@ -26,6 +25,7 @@ limitations under the License.
|
||||
#include "tensorflow/core/lib/core/errors.h"
|
||||
#include "tensorflow/core/lib/core/status.h"
|
||||
#include "tensorflow/core/lib/core/status_test_util.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#include "tensorflow/core/platform/test.h"
|
||||
#include "tensorflow/core/public/session.h"
|
||||
@ -34,7 +34,7 @@ namespace tensorflow {
|
||||
namespace serving {
|
||||
namespace {
|
||||
|
||||
static bool HasSubstr(absl::string_view base, absl::string_view substr) {
|
||||
static bool HasSubstr(StringPiece base, StringPiece substr) {
|
||||
bool ok = str_util::StrContains(base, substr);
|
||||
EXPECT_TRUE(ok) << base << ", expected substring " << substr;
|
||||
return ok;
|
||||
|
@ -47,7 +47,6 @@ cc_library(
|
||||
"//tensorflow/core:protos_all_cc",
|
||||
"//tensorflow/core/kernels:summary_interface",
|
||||
"//tensorflow/core/lib/db:sqlite",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -16,12 +16,12 @@ limitations under the License.
|
||||
|
||||
#include <deque>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/contrib/tensorboard/db/summary_converter.h"
|
||||
#include "tensorflow/core/framework/graph.pb.h"
|
||||
#include "tensorflow/core/framework/node_def.pb.h"
|
||||
#include "tensorflow/core/framework/register_types.h"
|
||||
#include "tensorflow/core/framework/summary.pb.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/lib/db/sqlite.h"
|
||||
#include "tensorflow/core/lib/random/random.h"
|
||||
#include "tensorflow/core/util/event.pb.h"
|
||||
@ -136,7 +136,7 @@ void PatchPluginName(SummaryMetadata* metadata, const char* name) {
|
||||
}
|
||||
}
|
||||
|
||||
Status SetDescription(Sqlite* db, int64 id, const absl::string_view& markdown) {
|
||||
Status SetDescription(Sqlite* db, int64 id, const StringPiece& markdown) {
|
||||
const char* sql = R"sql(
|
||||
INSERT OR REPLACE INTO Descriptions (id, description) VALUES (?, ?)
|
||||
)sql";
|
||||
@ -260,12 +260,12 @@ class GraphWriter {
|
||||
for (int node_id = 0; node_id < graph_->node_size(); ++node_id) {
|
||||
const NodeDef& node = graph_->node(node_id);
|
||||
for (int idx = 0; idx < node.input_size(); ++idx) {
|
||||
absl::string_view name = node.input(idx);
|
||||
StringPiece name = node.input(idx);
|
||||
int64 input_node_id;
|
||||
int64 input_node_idx = 0;
|
||||
int64 is_control = 0;
|
||||
size_t i = name.rfind(':');
|
||||
if (i != absl::string_view::npos) {
|
||||
if (i != StringPiece::npos) {
|
||||
if (!strings::safe_strto64(name.substr(i + 1, name.size() - i - 1),
|
||||
&input_node_idx)) {
|
||||
return errors::DataLoss("Bad NodeDef.input: ", name);
|
||||
@ -369,8 +369,7 @@ class GraphWriter {
|
||||
const uint64 now_;
|
||||
const int64 graph_id_;
|
||||
std::vector<string> name_copies_;
|
||||
std::unordered_map<absl::string_view, int64, StringPieceHasher>
|
||||
name_to_node_id_;
|
||||
std::unordered_map<StringPiece, int64, StringPieceHasher> name_to_node_id_;
|
||||
|
||||
TF_DISALLOW_COPY_AND_ASSIGN(GraphWriter);
|
||||
};
|
||||
@ -681,7 +680,7 @@ class SeriesWriter {
|
||||
} else {
|
||||
SqliteTransaction txn(*db);
|
||||
TF_RETURN_IF_ERROR(
|
||||
Update(db, step, computed_time, t, absl::string_view(), rowid));
|
||||
Update(db, step, computed_time, t, StringPiece(), rowid));
|
||||
TF_RETURN_IF_ERROR(UpdateNdString(db, t, rowid));
|
||||
return txn.Commit();
|
||||
}
|
||||
@ -691,7 +690,7 @@ class SeriesWriter {
|
||||
}
|
||||
|
||||
Status Update(Sqlite* db, int64 step, double computed_time, const Tensor& t,
|
||||
const absl::string_view& data, int64 rowid) {
|
||||
const StringPiece& data, int64 rowid) {
|
||||
const char* sql = R"sql(
|
||||
UPDATE OR REPLACE
|
||||
Tensors
|
||||
|
@ -29,7 +29,6 @@ cc_library(
|
||||
"//tensorflow/core:framework",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:protos_all_cc",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -19,7 +19,6 @@ limitations under the License.
|
||||
#include <ctime>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/contrib/tpu/profiler/op_profile.pb.h"
|
||||
#include "tensorflow/contrib/tpu/profiler/trace_events.pb.h"
|
||||
#include "tensorflow/contrib/tpu/profiler/trace_events_to_json.h"
|
||||
@ -64,8 +63,7 @@ Status WriteGzippedDataToFile(const string& filename, const string& data) {
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
Status DumpTraceToLogDirectory(absl::string_view run_dir,
|
||||
const string& host_prefix,
|
||||
Status DumpTraceToLogDirectory(StringPiece run_dir, const string& host_prefix,
|
||||
const string& encoded_trace, std::ostream* os) {
|
||||
string proto_path =
|
||||
JoinPath(run_dir, StrCat(host_prefix, kProtoTraceFileName));
|
||||
@ -88,7 +86,7 @@ Status DumpTraceToLogDirectory(absl::string_view run_dir,
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
Status DumpOpProfileToLogDirectory(absl::string_view run_dir,
|
||||
Status DumpOpProfileToLogDirectory(StringPiece run_dir,
|
||||
const string& host_prefix,
|
||||
const tpu::op_profile::Profile& profile,
|
||||
std::ostream* os) {
|
||||
@ -109,7 +107,7 @@ Status DumpOpProfileToLogDirectory(absl::string_view run_dir,
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
Status DumpToolDataToLogDirectory(absl::string_view run_dir,
|
||||
Status DumpToolDataToLogDirectory(StringPiece run_dir,
|
||||
const string& host_prefix,
|
||||
const tensorflow::ProfileToolData& tool,
|
||||
std::ostream* os) {
|
||||
|
@ -42,7 +42,6 @@ cc_library(
|
||||
deps = [
|
||||
"//tensorflow/core:framework",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/lib/strings/numbers.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
#include "tensorflow/core/lib/strings/strcat.h"
|
||||
@ -32,7 +32,7 @@ string VerbsUtil::AppendStepidToKey(const string& key, int64 step_id) {
|
||||
// static
|
||||
void VerbsUtil::GetKeyAndStepId(const string& key_with_step_id, string& key,
|
||||
int64& step_id) {
|
||||
absl::string_view s(key_with_step_id);
|
||||
StringPiece s(key_with_step_id);
|
||||
// a key (with step_id) has exact 6 parts if split by ";"
|
||||
// part 1: src_device;
|
||||
// part 2: src_incarnation;
|
||||
|
@ -485,7 +485,6 @@ cc_library(
|
||||
":platform_port",
|
||||
":platform_protobuf",
|
||||
"//tensorflow/core/platform/default/build_config:env",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -515,7 +514,6 @@ cc_library(
|
||||
":lib",
|
||||
":lib_platform",
|
||||
":platform_env",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -594,7 +592,6 @@ cc_library(
|
||||
"//tensorflow/core/platform/default/build_config:other",
|
||||
"//tensorflow/core/platform/default/build_config:platformlib",
|
||||
"//tensorflow/core/platform/default/build_config:port",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -981,7 +978,6 @@ cc_library(
|
||||
":lib",
|
||||
":lib_internal",
|
||||
":protos_all_cc",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -1482,7 +1478,6 @@ cc_library(
|
||||
"//tensorflow/core/kernels:ops_testutil",
|
||||
"//tensorflow/core/kernels:ops_util",
|
||||
"//tensorflow/core/kernels:random_ops",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -2198,7 +2193,6 @@ cc_library(
|
||||
":lib_proto_parsing",
|
||||
":abi",
|
||||
":core_stringpiece",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//third_party/eigen3",
|
||||
"//tensorflow/core/platform/default/build_config:platformlib",
|
||||
"@snappy",
|
||||
@ -2624,7 +2618,6 @@ tf_cuda_library(
|
||||
":protos_all_cc",
|
||||
":stats_calculator_portable",
|
||||
":version_lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//tensorflow/core/platform/default/build_config:platformlib",
|
||||
"//tensorflow/core/kernels:bounds_check",
|
||||
"//third_party/eigen3",
|
||||
@ -2755,7 +2748,6 @@ tf_cuda_library(
|
||||
":proto_text",
|
||||
":protos_all_cc",
|
||||
"//third_party/eigen3",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -2800,7 +2792,6 @@ tf_cuda_library(
|
||||
":function_ops_op_lib",
|
||||
":functional_grad",
|
||||
":functional_ops_op_lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//tensorflow/core/kernels:bounds_check",
|
||||
"//tensorflow/core/kernels:required",
|
||||
":core_cpu_impl",
|
||||
@ -2930,7 +2921,6 @@ tf_cuda_library(
|
||||
":lib_internal",
|
||||
":proto_text",
|
||||
":protos_all_cc",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//third_party/eigen3",
|
||||
"//tensorflow/core/grappler:grappler_item",
|
||||
] + mkl_deps(),
|
||||
@ -3010,7 +3000,6 @@ tf_cuda_library(
|
||||
":protos_all_cc",
|
||||
"//tensorflow/core/debug:debug_graph_utils",
|
||||
"//tensorflow/core/kernels:function_ops",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
alwayslink = 1,
|
||||
)
|
||||
@ -3134,7 +3123,6 @@ tf_cuda_library(
|
||||
":protos_all_cc",
|
||||
":stream_executor",
|
||||
"//third_party/eigen3",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
alwayslink = 1,
|
||||
)
|
||||
@ -3264,7 +3252,6 @@ cc_library(
|
||||
":lib",
|
||||
":lib_internal",
|
||||
":protos_all_cc",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -3380,7 +3367,6 @@ tf_cc_tests(
|
||||
":test",
|
||||
":test_main",
|
||||
"//third_party/eigen3",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@zlib_archive//:zlib",
|
||||
],
|
||||
)
|
||||
@ -3412,7 +3398,6 @@ tf_cc_test(
|
||||
":test",
|
||||
":test_main",
|
||||
"//third_party/eigen3",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -3484,7 +3469,6 @@ tf_cc_test(
|
||||
":protos_all_cc",
|
||||
":test",
|
||||
":test_main",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -3534,7 +3518,6 @@ tf_cc_test(
|
||||
":lib_internal",
|
||||
":test",
|
||||
":test_main",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -3696,7 +3679,6 @@ tf_cc_tests(
|
||||
"//tensorflow/cc:while_loop",
|
||||
"//tensorflow/core/kernels:ops_util",
|
||||
"//third_party/eigen3",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -3733,7 +3715,6 @@ tf_cc_tests(
|
||||
"//tensorflow/cc:sendrecv_ops",
|
||||
"//tensorflow/core/kernels:ops_util",
|
||||
"//third_party/eigen3",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -3917,7 +3898,6 @@ tf_cc_tests_gpu(
|
||||
":testlib",
|
||||
"//tensorflow/cc:cc_ops",
|
||||
"//tensorflow/core/kernels:ops_util",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -3966,7 +3946,6 @@ tf_cuda_cc_test(
|
||||
":testlib",
|
||||
"//tensorflow/cc:cc_ops",
|
||||
"//tensorflow/core/kernels:ops_util",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -4083,7 +4062,6 @@ tf_cc_test(
|
||||
"//tensorflow/core/kernels:immutable_constant_op",
|
||||
"//tensorflow/core/kernels:matmul_op",
|
||||
"//third_party/eigen3",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -4194,7 +4172,6 @@ tf_cuda_cc_test(
|
||||
":test",
|
||||
":test_main",
|
||||
":testlib",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//third_party/eigen3",
|
||||
"//tensorflow/cc:cc_ops",
|
||||
"//tensorflow/core/kernels:collective_ops",
|
||||
@ -4235,7 +4212,6 @@ tf_cc_test(
|
||||
":test",
|
||||
":test_main",
|
||||
":testlib",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//third_party/eigen3",
|
||||
"//tensorflow/cc:cc_ops",
|
||||
# Link with support for TensorFlow Debugger (tfdbg).
|
||||
@ -4376,7 +4352,6 @@ tf_cc_test(
|
||||
"//tensorflow/core/kernels:random_ops",
|
||||
"//tensorflow/core/kernels:shape_ops",
|
||||
"//third_party/eigen3",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -4769,7 +4744,6 @@ tf_cc_tests(
|
||||
"//tensorflow/cc:client_session",
|
||||
"//tensorflow/cc:function_ops",
|
||||
"//tensorflow/cc:ops",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -18,7 +18,6 @@ limitations under the License.
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/constant_folding.h"
|
||||
|
||||
#include "tensorflow/cc/ops/array_ops_internal.h"
|
||||
@ -641,7 +640,7 @@ class TestTFFileSystem : public ::tensorflow::NullFileSystem {
|
||||
return ::tensorflow::errors::Unimplemented(
|
||||
"NewReadOnlyMemoryRegionFromFile unimplemented");
|
||||
}
|
||||
const ::absl::string_view sp = data_tensor_.tensor_data();
|
||||
const ::tensorflow::StringPiece sp = data_tensor_.tensor_data();
|
||||
*result = std::unique_ptr<::tensorflow::ReadOnlyMemoryRegion>(
|
||||
new TestReadOnlyMemoryRegion(sp.data(), sp.size()));
|
||||
return ::tensorflow::Status::OK();
|
||||
|
@ -18,7 +18,6 @@ limitations under the License.
|
||||
#include <atomic>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/dma_helper.h"
|
||||
#include "tensorflow/core/framework/variant_op_registry.h"
|
||||
#include "tensorflow/core/lib/core/errors.h"
|
||||
@ -49,7 +48,7 @@ std::vector<RegistrationInfo>* MutableRegistry() {
|
||||
}
|
||||
|
||||
void CopyHostToDevice(const Tensor* input, Allocator* cpu_allocator,
|
||||
Allocator* out_allocator, absl::string_view edge_name,
|
||||
Allocator* out_allocator, StringPiece edge_name,
|
||||
Device* dst, Tensor* output,
|
||||
DeviceContext* recv_dev_context, StatusCallback done) {
|
||||
if (input->dtype() == DT_VARIANT) {
|
||||
@ -114,7 +113,7 @@ void CopyHostToDevice(const Tensor* input, Allocator* cpu_allocator,
|
||||
}
|
||||
|
||||
void CopyDeviceToHost(const Tensor* input, Allocator* cpu_allocator,
|
||||
Allocator* out_allocator, absl::string_view edge_name,
|
||||
Allocator* out_allocator, StringPiece edge_name,
|
||||
Device* src, Tensor* output,
|
||||
DeviceContext* send_dev_context, StatusCallback done) {
|
||||
if (input->dtype() == DT_VARIANT) {
|
||||
@ -247,8 +246,7 @@ void CopyDeviceToDevice(CopyTensor::CopyFunction copy_function,
|
||||
} // namespace
|
||||
|
||||
// static
|
||||
void CopyTensor::ViaDMA(absl::string_view edge_name,
|
||||
DeviceContext* send_dev_context,
|
||||
void CopyTensor::ViaDMA(StringPiece edge_name, DeviceContext* send_dev_context,
|
||||
DeviceContext* recv_dev_context, Device* src,
|
||||
Device* dst, const AllocatorAttributes src_alloc_attr,
|
||||
const AllocatorAttributes dst_alloc_attr,
|
||||
|
@ -16,7 +16,6 @@ limitations under the License.
|
||||
#ifndef TENSORFLOW_CORE_COMMON_RUNTIME_COPY_TENSOR_H_
|
||||
#define TENSORFLOW_CORE_COMMON_RUNTIME_COPY_TENSOR_H_
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/device.h"
|
||||
#include "tensorflow/core/framework/allocator.h"
|
||||
#include "tensorflow/core/framework/device_base.h"
|
||||
@ -41,8 +40,7 @@ class CopyTensor {
|
||||
// the type of devices and memory in use, the copy may be performed
|
||||
// synchronously or asynchronously. 'done' will be invoked only
|
||||
// after the copy is actually complete.
|
||||
static void ViaDMA(absl::string_view edge_name,
|
||||
DeviceContext* send_dev_context,
|
||||
static void ViaDMA(StringPiece edge_name, DeviceContext* send_dev_context,
|
||||
DeviceContext* recv_dev_context, Device* src, Device* dst,
|
||||
const AllocatorAttributes src_alloc_attr,
|
||||
const AllocatorAttributes dst_alloc_attr,
|
||||
|
@ -16,7 +16,6 @@ limitations under the License.
|
||||
#include "tensorflow/core/common_runtime/device_mgr.h"
|
||||
|
||||
#include <vector>
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/local_device.h"
|
||||
#include "tensorflow/core/framework/device_attributes.pb.h"
|
||||
#include "tensorflow/core/lib/core/errors.h"
|
||||
@ -52,11 +51,11 @@ DeviceMgr::~DeviceMgr() {
|
||||
for (Device* p : devices_) delete p;
|
||||
}
|
||||
|
||||
absl::string_view DeviceMgr::CopyToBackingStore(absl::string_view s) {
|
||||
StringPiece DeviceMgr::CopyToBackingStore(StringPiece s) {
|
||||
size_t n = s.size();
|
||||
char* space = name_backing_store_.Alloc(n);
|
||||
memcpy(space, s.data(), n);
|
||||
return absl::string_view(space, n);
|
||||
return StringPiece(space, n);
|
||||
}
|
||||
|
||||
void DeviceMgr::ListDeviceAttributes(
|
||||
@ -90,11 +89,11 @@ string DeviceMgr::DeviceMappingString() const {
|
||||
return out;
|
||||
}
|
||||
|
||||
Status DeviceMgr::LookupDevice(absl::string_view name, Device** device) const {
|
||||
Status DeviceMgr::LookupDevice(StringPiece name, Device** device) const {
|
||||
Status s;
|
||||
auto iter = device_map_.find(name);
|
||||
if (iter == device_map_.end()) {
|
||||
std::vector<absl::string_view> device_names;
|
||||
std::vector<StringPiece> device_names;
|
||||
for (auto&& itr : device_map_) {
|
||||
device_names.push_back(itr.first);
|
||||
}
|
||||
|
@ -21,10 +21,10 @@ limitations under the License.
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/device.h"
|
||||
#include "tensorflow/core/lib/core/arena.h"
|
||||
#include "tensorflow/core/lib/core/status.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/lib/gtl/inlined_vector.h"
|
||||
#include "tensorflow/core/platform/macros.h"
|
||||
|
||||
@ -53,7 +53,7 @@ class DeviceMgr {
|
||||
|
||||
// Assigns *device with pointer to Device of the given name.
|
||||
// Accepts either a full device name, or just the replica-local suffix.
|
||||
Status LookupDevice(absl::string_view name, Device** device) const;
|
||||
Status LookupDevice(StringPiece name, Device** device) const;
|
||||
|
||||
// Clears given containers of all devices if 'container' is
|
||||
// non-empty. Otherwise, clears default containers of all devices.
|
||||
@ -66,9 +66,9 @@ class DeviceMgr {
|
||||
typedef gtl::InlinedVector<Device*, 8> DeviceVec;
|
||||
DeviceVec devices_;
|
||||
|
||||
absl::string_view CopyToBackingStore(absl::string_view s);
|
||||
StringPiece CopyToBackingStore(StringPiece s);
|
||||
|
||||
std::unordered_map<absl::string_view, Device*, StringPieceHasher> device_map_;
|
||||
std::unordered_map<StringPiece, Device*, StringPieceHasher> device_map_;
|
||||
core::Arena name_backing_store_; // Storage for keys in device_map_
|
||||
std::unordered_map<string, int> device_type_counts_;
|
||||
|
||||
|
@ -19,9 +19,9 @@ limitations under the License.
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/device.h"
|
||||
#include "tensorflow/core/common_runtime/device_factory.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/lib/gtl/map_util.h"
|
||||
|
||||
namespace tensorflow {
|
||||
@ -68,7 +68,7 @@ static bool DeviceTypeComparator(const DeviceType& a, const DeviceType& b) {
|
||||
return a_priority > b_priority;
|
||||
}
|
||||
|
||||
return absl::string_view(a.type()) < absl::string_view(b.type());
|
||||
return StringPiece(a.type()) < StringPiece(b.type());
|
||||
}
|
||||
|
||||
std::vector<DeviceType> DeviceSet::PrioritizedDeviceTypeList() const {
|
||||
|
@ -19,7 +19,6 @@ limitations under the License.
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/collective_executor_mgr.h"
|
||||
#include "tensorflow/core/common_runtime/collective_param_resolver_local.h"
|
||||
#include "tensorflow/core/common_runtime/constant_folding.h"
|
||||
@ -1193,7 +1192,7 @@ Status DirectSession::CreateExecutors(
|
||||
|
||||
if (run_state_args->is_partial_run) {
|
||||
ek->graph = std::move(run_state_args->graph);
|
||||
std::unordered_set<absl::string_view, StringPieceHasher> names;
|
||||
std::unordered_set<StringPiece, StringPieceHasher> names;
|
||||
for (const string& input : callable_options.feed()) {
|
||||
TensorId id(ParseTensorName(input));
|
||||
names.emplace(id.first);
|
||||
|
@ -23,7 +23,6 @@ limitations under the License.
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/costmodel_manager.h"
|
||||
#include "tensorflow/core/common_runtime/debugger_state_interface.h"
|
||||
#include "tensorflow/core/common_runtime/device_mgr.h"
|
||||
@ -66,8 +65,7 @@ class DirectSession : public Session {
|
||||
~DirectSession() override;
|
||||
|
||||
typedef std::vector<std::pair<string, Tensor>> NamedTensorList;
|
||||
typedef std::unordered_map<absl::string_view, Node*, StringPieceHasher>
|
||||
NameNodeMap;
|
||||
typedef std::unordered_map<StringPiece, Node*, StringPieceHasher> NameNodeMap;
|
||||
|
||||
::tensorflow::Status Create(const GraphDef& graph) override;
|
||||
::tensorflow::Status Extend(const GraphDef& graph) override;
|
||||
|
@ -22,7 +22,6 @@ limitations under the License.
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/device_factory.h"
|
||||
#include "tensorflow/core/common_runtime/device_mgr.h"
|
||||
#include "tensorflow/core/common_runtime/function_testlib.h"
|
||||
@ -2041,8 +2040,8 @@ void TestFeedAndFetchTensorsInDeviceMemory(
|
||||
<< DataType_Name(dtype);
|
||||
TF_ASSERT_OK(session->ReleaseCallable(handle)) << DataType_Name(dtype);
|
||||
ASSERT_EQ(1, outputs.size());
|
||||
const absl::string_view actual_data = outputs[0].tensor_data();
|
||||
const absl::string_view expected_data = host_tensor.tensor_data();
|
||||
const StringPiece actual_data = outputs[0].tensor_data();
|
||||
const StringPiece expected_data = host_tensor.tensor_data();
|
||||
EXPECT_EQ(expected_data.size(), actual_data.size()) << DataType_Name(dtype);
|
||||
EXPECT_EQ(0, memcmp(expected_data.data(), actual_data.data(),
|
||||
std::min(expected_data.size(), actual_data.size())))
|
||||
|
@ -49,7 +49,6 @@ tf_cuda_library(
|
||||
deps = [
|
||||
":eager_executor",
|
||||
":kernel_and_device",
|
||||
"@com_google_absl//absl/strings",
|
||||
] + select({
|
||||
"//tensorflow:android": [
|
||||
"//tensorflow/core:android_tensorflow_lib_lite",
|
||||
@ -198,7 +197,6 @@ cc_library(
|
||||
":eager_operation",
|
||||
":kernel_and_device",
|
||||
":tensor_handle",
|
||||
"@com_google_absl//absl/strings",
|
||||
] + select({
|
||||
"//tensorflow:android": [
|
||||
"//tensorflow/core:android_tensorflow_lib_lite",
|
||||
@ -223,7 +221,6 @@ tf_cuda_library(
|
||||
deps = [
|
||||
":kernel_and_device",
|
||||
"@farmhash_archive//:farmhash",
|
||||
"@com_google_absl//absl/strings",
|
||||
# Only the TF_AttrType enum is required, so pull in just the C headers.
|
||||
# TODO(b/113535673): Break this dependency and avoid the C header completely.
|
||||
"//tensorflow/c:c_api_headers",
|
||||
|
@ -15,7 +15,6 @@ limitations under the License.
|
||||
|
||||
#include "tensorflow/core/common_runtime/eager/attr_builder.h"
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/device_factory.h"
|
||||
#include "tensorflow/core/common_runtime/eager/kernel_and_device.h"
|
||||
#include "tensorflow/core/common_runtime/rendezvous_mgr.h"
|
||||
@ -97,12 +96,11 @@ Status AttrTypeMapForOp(const char* op_name, const AttrTypeMap** out) {
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
#define DEFINE_SET_ATTR(value_type, value_field) \
|
||||
template <> \
|
||||
AttrBuilder& AttrBuilder::Set(absl::string_view attr_name, \
|
||||
value_type&& value) { \
|
||||
value_field.push_back(std::make_pair(attr_name, value)); \
|
||||
return *this; \
|
||||
#define DEFINE_SET_ATTR(value_type, value_field) \
|
||||
template <> \
|
||||
AttrBuilder& AttrBuilder::Set(StringPiece attr_name, value_type&& value) { \
|
||||
value_field.push_back(std::make_pair(attr_name, value)); \
|
||||
return *this; \
|
||||
}
|
||||
|
||||
DEFINE_SET_ATTR(float, float_attrs_);
|
||||
@ -196,13 +194,13 @@ void CombineUnordered(const tensorflow::Fprint128& a,
|
||||
b->high64 += a.high64;
|
||||
}
|
||||
|
||||
inline tensorflow::Fprint128 CacheKeyHelper(absl::string_view s,
|
||||
inline tensorflow::Fprint128 CacheKeyHelper(StringPiece s,
|
||||
const tensorflow::Fprint128& b) {
|
||||
tensorflow::Fprint128 a = tensorflow::Fingerprint128(s);
|
||||
return FingerprintCat128(a, b);
|
||||
}
|
||||
|
||||
inline tensorflow::Fprint128 CacheKeyHelper(absl::string_view s, uint64 b) {
|
||||
inline tensorflow::Fprint128 CacheKeyHelper(StringPiece s, uint64 b) {
|
||||
return CacheKeyHelper(s, {b, b});
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@ limitations under the License.
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/c/c_api.h"
|
||||
#include "tensorflow/core/common_runtime/device.h"
|
||||
#include "tensorflow/core/common_runtime/eager/kernel_and_device.h"
|
||||
@ -95,7 +94,7 @@ class AttrBuilder {
|
||||
AttrBuilder& NumInputs(int n);
|
||||
|
||||
template <class T>
|
||||
AttrBuilder& Set(absl::string_view attr_name, T&& value) {
|
||||
AttrBuilder& Set(StringPiece attr_name, T&& value) {
|
||||
MayBeInitializeNodeDef();
|
||||
SetInAttrValueMap(node_def_->mutable_attr(), attr_name, value);
|
||||
return *this;
|
||||
@ -108,8 +107,7 @@ class AttrBuilder {
|
||||
|
||||
private:
|
||||
template <class T>
|
||||
using AttrVec =
|
||||
tensorflow::gtl::InlinedVector<std::pair<absl::string_view, T>, 2>;
|
||||
using AttrVec = tensorflow::gtl::InlinedVector<std::pair<StringPiece, T>, 2>;
|
||||
|
||||
void MayBeInitializeNodeDef();
|
||||
// Fill `m` with the attr-value pairs set via AttrBuilder::Set() so far, as
|
||||
@ -121,7 +119,7 @@ class AttrBuilder {
|
||||
void FillAttrValueMap(AttrValueMap* m, bool include_those_in_node_def) const;
|
||||
|
||||
template <class T>
|
||||
void SetInAttrValueMap(AttrValueMap* m, absl::string_view attr_name,
|
||||
void SetInAttrValueMap(AttrValueMap* m, StringPiece attr_name,
|
||||
T&& value) const {
|
||||
DCHECK(!node_def_finalized_)
|
||||
<< "Calling SetInAttrValueMap after BuildNodeDef.";
|
||||
@ -150,15 +148,16 @@ class AttrBuilder {
|
||||
}; // namespace tensorflow
|
||||
|
||||
template <>
|
||||
AttrBuilder& AttrBuilder::Set(absl::string_view attr_name, int&& value);
|
||||
AttrBuilder& AttrBuilder::Set(StringPiece attr_name, int&& value);
|
||||
template <>
|
||||
AttrBuilder& AttrBuilder::Set(absl::string_view attr_name, float&& value);
|
||||
AttrBuilder& AttrBuilder::Set(StringPiece attr_name, float&& value);
|
||||
template <>
|
||||
AttrBuilder& AttrBuilder::Set(absl::string_view attr_name, bool&& value);
|
||||
AttrBuilder& AttrBuilder::Set(StringPiece attr_name, bool&& value);
|
||||
template <>
|
||||
AttrBuilder& AttrBuilder::Set(absl::string_view attr_name,
|
||||
AttrBuilder& AttrBuilder::Set(StringPiece attr_name,
|
||||
tensorflow::DataType&& value);
|
||||
|
||||
|
||||
} // namespace tensorflow
|
||||
|
||||
#endif // TENSORFLOW_CORE_COMMON_RUNTIME_EAGER_ATTR_BUILDER_H_
|
||||
|
@ -15,7 +15,6 @@ limitations under the License.
|
||||
|
||||
#include "tensorflow/core/common_runtime/eager/context.h"
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/device_set.h"
|
||||
#include "tensorflow/core/common_runtime/process_util.h"
|
||||
#include "tensorflow/core/framework/resource_mgr.h"
|
||||
@ -25,7 +24,7 @@ limitations under the License.
|
||||
namespace tensorflow {
|
||||
namespace {
|
||||
|
||||
bool ReadBoolFromEnvVar(absl::string_view env_var_name, bool default_val) {
|
||||
bool ReadBoolFromEnvVar(StringPiece env_var_name, bool default_val) {
|
||||
bool val;
|
||||
if (tensorflow::ReadBoolFromEnvVar(env_var_name, default_val, &val).ok()) {
|
||||
return val;
|
||||
|
@ -17,7 +17,6 @@ limitations under the License.
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/device.h"
|
||||
#include "tensorflow/core/common_runtime/device_set.h"
|
||||
#include "tensorflow/core/common_runtime/eager/context.h"
|
||||
@ -821,7 +820,7 @@ Status FindDeviceFromName(EagerContext* ctx, const char* device_name,
|
||||
}
|
||||
|
||||
Status ExecuteSend(EagerContext* ctx, tensorflow::Device* device,
|
||||
TensorHandle* h, absl::string_view wire_id,
|
||||
TensorHandle* h, StringPiece wire_id,
|
||||
const string& recv_device) {
|
||||
const tensorflow::AttrTypeMap* types;
|
||||
TF_RETURN_IF_ERROR(tensorflow::AttrTypeMapForOp("_Send", &types));
|
||||
@ -848,7 +847,7 @@ Status ExecuteSend(EagerContext* ctx, tensorflow::Device* device,
|
||||
}
|
||||
|
||||
Status ExecuteRecv(EagerContext* ctx, tensorflow::Device* device,
|
||||
DataType dtype, absl::string_view wire_id,
|
||||
DataType dtype, StringPiece wire_id,
|
||||
const string& send_device, int64 send_device_incarnation,
|
||||
TensorHandle** result) {
|
||||
const tensorflow::AttrTypeMap* types;
|
||||
|
@ -18,7 +18,6 @@ limitations under the License.
|
||||
#include <deque>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/device.h"
|
||||
#include "tensorflow/core/common_runtime/executor.h"
|
||||
#include "tensorflow/core/common_runtime/executor_factory.h"
|
||||
@ -584,7 +583,7 @@ Status FunctionLibraryRuntimeImpl::ReleaseHandle(Handle handle) {
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
void DumpGraph(absl::string_view label, const Graph* g) {
|
||||
void DumpGraph(StringPiece label, const Graph* g) {
|
||||
// TODO(zhifengc): Change Graph to record #nodes.
|
||||
VLOG(1) << "Graph " << label << " #nodes " << g->num_nodes() << " #edges "
|
||||
<< g->num_edges();
|
||||
|
@ -19,7 +19,6 @@ limitations under the License.
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/device.h"
|
||||
#include "tensorflow/core/common_runtime/device_mgr.h"
|
||||
#include "tensorflow/core/common_runtime/process_function_library_runtime.h"
|
||||
@ -125,7 +124,7 @@ bool ExpandInlineFunctions(FunctionLibraryRuntime* lib, Graph* graph);
|
||||
|
||||
// Dump the contents of the "graph" to log files if the logging level is
|
||||
// sufficiently high.
|
||||
void DumpGraph(absl::string_view label, const Graph* g);
|
||||
void DumpGraph(StringPiece label, const Graph* g);
|
||||
|
||||
// Applies graph rewrite optimization such as inlining, dead code
|
||||
// removal, etc.
|
||||
|
@ -18,7 +18,6 @@ limitations under the License.
|
||||
#include <atomic>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/cc/ops/array_ops_internal.h"
|
||||
#include "tensorflow/cc/ops/function_ops.h"
|
||||
#include "tensorflow/cc/ops/functional_ops.h"
|
||||
@ -56,7 +55,7 @@ Status GetOpSig(const string& op, const OpDef** sig) {
|
||||
return OpRegistry::Global()->LookUpOpDef(op, sig);
|
||||
}
|
||||
|
||||
void HasError(const Status& s, absl::string_view substr) {
|
||||
void HasError(const Status& s, StringPiece substr) {
|
||||
EXPECT_TRUE(str_util::StrContains(s.ToString(), substr))
|
||||
<< s << ", expected substring " << substr;
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#if GOOGLE_CUDA
|
||||
|
||||
#include "tensorflow/core/common_runtime/gpu/gpu_device.h"
|
||||
@ -54,7 +53,7 @@ Status GetComputeCapability(PlatformGpuId gpu_id, int* cc_major,
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
void ExpectErrorMessageSubstr(const Status& s, absl::string_view substr) {
|
||||
void ExpectErrorMessageSubstr(const Status& s, StringPiece substr) {
|
||||
EXPECT_TRUE(str_util::StrContains(s.ToString(), substr))
|
||||
<< s << ", expected substring " << substr;
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/device.h"
|
||||
#include "tensorflow/core/common_runtime/gpu/gpu_event_mgr.h"
|
||||
#include "tensorflow/core/common_runtime/gpu/gpu_util.h"
|
||||
@ -32,7 +31,7 @@ void GPUDeviceContext::CopyCPUTensorToDevice(const Tensor* cpu_tensor,
|
||||
}
|
||||
|
||||
void GPUDeviceContext::CopyDeviceTensorToCPU(const Tensor* device_tensor,
|
||||
absl::string_view tensor_name,
|
||||
StringPiece tensor_name,
|
||||
Device* device, Tensor* cpu_tensor,
|
||||
StatusCallback done) {
|
||||
GPUUtil::CopyGPUTensorToCPU(device, this, device_tensor, cpu_tensor, done);
|
||||
|
@ -16,7 +16,6 @@ limitations under the License.
|
||||
#ifndef TENSORFLOW_CORE_COMMON_RUNTIME_GPU_DEVICE_CONTEXT_H_
|
||||
#define TENSORFLOW_CORE_COMMON_RUNTIME_GPU_DEVICE_CONTEXT_H_
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/device.h"
|
||||
#include "tensorflow/core/framework/device_base.h"
|
||||
#include "tensorflow/core/lib/gtl/inlined_vector.h"
|
||||
@ -54,9 +53,9 @@ class GPUDeviceContext : public DeviceContext {
|
||||
Tensor* device_tensor,
|
||||
StatusCallback done) const override;
|
||||
|
||||
void CopyDeviceTensorToCPU(const Tensor* device_tensor,
|
||||
absl::string_view edge_name, Device* device,
|
||||
Tensor* cpu_tensor, StatusCallback done) override;
|
||||
void CopyDeviceTensorToCPU(const Tensor* device_tensor, StringPiece edge_name,
|
||||
Device* device, Tensor* cpu_tensor,
|
||||
StatusCallback done) override;
|
||||
|
||||
void MaintainLifetimeOnStream(const Tensor* t,
|
||||
se::Stream* stream) const override {}
|
||||
|
@ -15,7 +15,6 @@ limitations under the License.
|
||||
|
||||
#include "tensorflow/core/common_runtime/lower_if_while.h"
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/cc/client/client_session.h"
|
||||
#include "tensorflow/cc/framework/ops.h"
|
||||
#include "tensorflow/cc/ops/array_ops.h"
|
||||
@ -39,7 +38,7 @@ namespace {
|
||||
|
||||
typedef FunctionDefHelper FDH;
|
||||
|
||||
static void AssertHasSubstr(absl::string_view s, absl::string_view expected) {
|
||||
static void AssertHasSubstr(StringPiece s, StringPiece expected) {
|
||||
ASSERT_TRUE(str_util::StrContains(s, expected))
|
||||
<< "'" << s << "' does not contain '" << expected << "'";
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ limitations under the License.
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/device.h"
|
||||
#include "tensorflow/core/framework/device_attributes.pb.h"
|
||||
#include "tensorflow/core/framework/graph.pb.h"
|
||||
@ -29,6 +28,7 @@ limitations under the License.
|
||||
#include "tensorflow/core/framework/types.h"
|
||||
#include "tensorflow/core/framework/types.pb.h"
|
||||
#include "tensorflow/core/lib/core/errors.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
|
||||
namespace tensorflow {
|
||||
@ -37,9 +37,8 @@ namespace {
|
||||
|
||||
// We hoist the conversion from C-style string literal to StringPiece here,
|
||||
// so that we can avoid the many repeated calls to strlen().
|
||||
const absl::string_view kColocationAttrNameStringPiece(kColocationAttrName);
|
||||
const absl::string_view kColocationGroupPrefixStringPiece(
|
||||
kColocationGroupPrefix);
|
||||
const StringPiece kColocationAttrNameStringPiece(kColocationAttrName);
|
||||
const StringPiece kColocationGroupPrefixStringPiece(kColocationGroupPrefix);
|
||||
|
||||
// Returns a list of devices having type in supported_device_types. The
|
||||
// returned list is sorted by preferred type (higher numeric type is preferred).
|
||||
@ -69,7 +68,7 @@ std::vector<Device*> FilterSupportedDevices(
|
||||
if (a_priority != b_priority) {
|
||||
return a_priority > b_priority;
|
||||
}
|
||||
return absl::string_view(a->name()) < absl::string_view(b->name());
|
||||
return StringPiece(a->name()) < StringPiece(b->name());
|
||||
};
|
||||
std::vector<Device*>::iterator sort_start;
|
||||
if (filtered_default_device != nullptr) {
|
||||
@ -145,7 +144,7 @@ class ColocationGraph {
|
||||
// 'string' values stored in NodeDef attribute lists, as well as StringPiece
|
||||
// values that refer to 'string' values from NodeDef::name(), without
|
||||
// performing any string allocations.
|
||||
std::unordered_map<absl::string_view, const Node*, StringPieceHasher>
|
||||
std::unordered_map<StringPiece, const Node*, StringPieceHasher>
|
||||
colocation_group_root;
|
||||
|
||||
for (Node* node : graph_->op_nodes()) {
|
||||
@ -162,7 +161,7 @@ class ColocationGraph {
|
||||
node->attrs().Find(kColocationAttrNameStringPiece);
|
||||
if (attr_value != nullptr && attr_value->has_list()) {
|
||||
for (const string& class_spec : attr_value->list().s()) {
|
||||
absl::string_view spec(class_spec);
|
||||
StringPiece spec(class_spec);
|
||||
if (str_util::ConsumePrefix(&spec,
|
||||
kColocationGroupPrefixStringPiece)) {
|
||||
found_spec = true;
|
||||
@ -184,9 +183,9 @@ class ColocationGraph {
|
||||
}
|
||||
|
||||
Status ColocateNodeToGroup(
|
||||
std::unordered_map<absl::string_view, const Node*, StringPieceHasher>*
|
||||
std::unordered_map<StringPiece, const Node*, StringPieceHasher>*
|
||||
colocation_group_root,
|
||||
Node* node, absl::string_view colocation_group) {
|
||||
Node* node, StringPiece colocation_group) {
|
||||
const Node*& root_node = (*colocation_group_root)[colocation_group];
|
||||
if (root_node == nullptr) {
|
||||
// This is the first node of the colocation group, so
|
||||
|
@ -16,10 +16,10 @@ limitations under the License.
|
||||
#ifndef TENSORFLOW_CORE_COMMON_RUNTIME_PROFILE_HANDLER_H_
|
||||
#define TENSORFLOW_CORE_COMMON_RUNTIME_PROFILE_HANDLER_H_
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/framework/step_stats.pb.h"
|
||||
#include "tensorflow/core/graph/types.h"
|
||||
#include "tensorflow/core/lib/core/status.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
|
||||
namespace tensorflow {
|
||||
|
||||
@ -41,9 +41,8 @@ class ProfileHandler {
|
||||
// - op_type: String name of the Op.
|
||||
// - details: Main content for timeline click text.
|
||||
virtual void RecordOneOp(const string& device, const NodeExecStats& stats,
|
||||
bool is_copy, absl::string_view label,
|
||||
absl::string_view op_type,
|
||||
absl::string_view details) = 0;
|
||||
bool is_copy, StringPiece label, StringPiece op_type,
|
||||
StringPiece details) = 0;
|
||||
|
||||
// Records that the current step finished.
|
||||
//
|
||||
|
@ -19,7 +19,6 @@ limitations under the License.
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/eval_const_tensor.h"
|
||||
#include "tensorflow/core/framework/common_shape_fns.h"
|
||||
#include "tensorflow/core/framework/node_def.pb.h"
|
||||
@ -69,7 +68,7 @@ Status InferShapesForFunctionSubNode(const Node* node, ShapeRefiner* refiner,
|
||||
TF_RETURN_IF_ERROR(refiner->AddNode(node));
|
||||
InferenceContext* node_context = CHECK_NOTNULL(refiner->GetContext(node));
|
||||
|
||||
if (absl::string_view(node->type_string()) == kArgOp) {
|
||||
if (StringPiece(node->type_string()) == kArgOp) {
|
||||
// Handle special node: function input.
|
||||
// Shapes for these nodes are provided in the outer inference
|
||||
// context.
|
||||
@ -89,7 +88,7 @@ Status InferShapesForFunctionSubNode(const Node* node, ShapeRefiner* refiner,
|
||||
if (resource) {
|
||||
node_context->set_output_handle_shapes_and_types(0, *resource);
|
||||
}
|
||||
} else if (absl::string_view(node->type_string()) == kRetvalOp) {
|
||||
} else if (StringPiece(node->type_string()) == kRetvalOp) {
|
||||
// Handle special node: function output.
|
||||
// Shapes inferred for these nodes go into the outer inference
|
||||
// context.
|
||||
|
@ -14,7 +14,6 @@ limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#include "tensorflow/core/common_runtime/step_stats_collector.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/costmodel_manager.h"
|
||||
#include "tensorflow/core/framework/allocation_description.pb.h"
|
||||
#include "tensorflow/core/framework/op_kernel.h"
|
||||
@ -23,6 +22,7 @@ limitations under the License.
|
||||
#include "tensorflow/core/framework/tracking_allocator.h"
|
||||
#include "tensorflow/core/graph/costmodel.h"
|
||||
#include "tensorflow/core/graph/graph.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/lib/strings/numbers.h"
|
||||
#include "tensorflow/core/lib/strings/scanner.h"
|
||||
#include "tensorflow/core/lib/strings/stringprintf.h"
|
||||
@ -212,7 +212,7 @@ static int ExtractGpuWithStreamAll(string device_name) {
|
||||
scanner.RestartCapture().Many(strings::Scanner::DIGIT).StopCapture();
|
||||
// Check that the digits are preceded by the 'device:GPU:' string
|
||||
scanner.OneLiteral(":UPG:ecived");
|
||||
absl::string_view capture;
|
||||
StringPiece capture;
|
||||
bool matched = scanner.GetResult(nullptr, &capture);
|
||||
|
||||
if (!matched) {
|
||||
@ -241,7 +241,7 @@ static int ExtractGpuWithoutStream(string device_name) {
|
||||
scanner.RestartCapture().Many(strings::Scanner::DIGIT).StopCapture();
|
||||
// Check that the digits are preceded by the 'device:GPU:' string
|
||||
scanner.OneLiteral(":UPG:ecived");
|
||||
absl::string_view capture;
|
||||
StringPiece capture;
|
||||
bool matched = scanner.GetResult(nullptr, &capture);
|
||||
|
||||
if (!matched) {
|
||||
@ -276,7 +276,7 @@ void StepStatsCollector::BuildCostModel(
|
||||
const DeviceStepStats* hardware_stats;
|
||||
};
|
||||
|
||||
std::unordered_map<absl::string_view, DeviceStats, StringPieceHasher>
|
||||
std::unordered_map<StringPiece, DeviceStats, StringPieceHasher>
|
||||
per_device_stats;
|
||||
std::unordered_map<int, const DeviceStepStats*> gpu_hardware_stats;
|
||||
|
||||
@ -295,7 +295,7 @@ void StepStatsCollector::BuildCostModel(
|
||||
}
|
||||
|
||||
for (auto& itr : per_device_stats) {
|
||||
const absl::string_view device_name = itr.first;
|
||||
const StringPiece device_name = itr.first;
|
||||
const int gpu_id = ExtractGpuWithoutStream(string(device_name));
|
||||
if (gpu_id >= 0) {
|
||||
// Reference the gpu hardware stats in addition to the regular stats
|
||||
@ -307,7 +307,7 @@ void StepStatsCollector::BuildCostModel(
|
||||
}
|
||||
|
||||
for (auto itr : device_map) {
|
||||
const absl::string_view device = itr.first;
|
||||
const StringPiece device = itr.first;
|
||||
if (per_device_stats.find(device) == per_device_stats.end()) {
|
||||
continue;
|
||||
}
|
||||
@ -316,8 +316,7 @@ void StepStatsCollector::BuildCostModel(
|
||||
CostModel* cm = cost_model_manager->FindOrCreateCostModel(graph);
|
||||
cm->IncrementUpdateTimes();
|
||||
|
||||
std::unordered_map<absl::string_view, Node*, StringPieceHasher>
|
||||
name_to_node;
|
||||
std::unordered_map<StringPiece, Node*, StringPieceHasher> name_to_node;
|
||||
for (Node* n : graph->nodes()) {
|
||||
name_to_node.emplace(n->name(), n);
|
||||
}
|
||||
|
@ -109,7 +109,6 @@ tf_cuda_library(
|
||||
"//tensorflow/core:lib_internal",
|
||||
"//tensorflow/core:proto_text",
|
||||
"//tensorflow/core:protos_all_cc",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
alwayslink = 1,
|
||||
)
|
||||
@ -133,7 +132,6 @@ tf_cuda_library(
|
||||
"//tensorflow/core:lib_internal",
|
||||
"//tensorflow/core:proto_text",
|
||||
"//tensorflow/core:protos_all_cc",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
alwayslink = 1,
|
||||
)
|
||||
|
@ -15,7 +15,6 @@ limitations under the License.
|
||||
|
||||
#include "tensorflow/core/debug/debug_graph_utils.h"
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/memory_types.h"
|
||||
#include "tensorflow/core/framework/kernel_def.pb.h"
|
||||
#include "tensorflow/core/framework/node_def_builder.h"
|
||||
@ -345,7 +344,7 @@ Status DebugNodeInserter::ParseDebugOpName(
|
||||
|
||||
std::vector<string> attribute_segs = str_util::Split(arguments, ";");
|
||||
for (const string& attribute_seg : attribute_segs) {
|
||||
absl::string_view seg(attribute_seg);
|
||||
StringPiece seg(attribute_seg);
|
||||
str_util::RemoveWhitespaceContext(&seg);
|
||||
if (seg.empty()) {
|
||||
continue;
|
||||
|
@ -23,7 +23,6 @@ limitations under the License.
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include "absl/strings/string_view.h"
|
||||
|
||||
#ifndef PLATFORM_WINDOWS
|
||||
#include "grpcpp/create_channel.h"
|
||||
@ -309,7 +308,7 @@ Status ReadEventFromFile(const string& dump_file_path, Event* event) {
|
||||
return s;
|
||||
}
|
||||
|
||||
absl::string_view result;
|
||||
StringPiece result;
|
||||
s = file->Read(0, file_size, &result, &(content)[0]);
|
||||
if (!s.ok()) {
|
||||
return s;
|
||||
|
@ -172,7 +172,6 @@ cc_library(
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:protos_all_cc",
|
||||
"//tensorflow/core:worker_proto_cc",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -289,7 +288,6 @@ cc_library(
|
||||
"//tensorflow/core:core_cpu_internal",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:worker_proto_cc",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -346,7 +344,6 @@ cc_library(
|
||||
"//tensorflow/core:master_proto_cc",
|
||||
"//tensorflow/core:protos_all_cc",
|
||||
"//tensorflow/core/debug:debug_graph_utils",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -400,7 +397,6 @@ cc_library(
|
||||
"//tensorflow/core:framework_internal",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:lib_internal",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -18,7 +18,6 @@ limitations under the License.
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/copy_tensor.h"
|
||||
#include "tensorflow/core/common_runtime/device.h"
|
||||
#include "tensorflow/core/common_runtime/device_mgr.h"
|
||||
@ -145,8 +144,8 @@ BaseRemoteRendezvous::~BaseRemoteRendezvous() {
|
||||
// Returns true if "device_name" is a valid full name of local device
|
||||
// of the "worker". This helper is purely based on the worker name
|
||||
// and device name and does no lookups in the worker->device_mgr.
|
||||
static bool IsLocalDevice(const absl::string_view worker_name,
|
||||
const absl::string_view device_name) {
|
||||
static bool IsLocalDevice(const StringPiece worker_name,
|
||||
const StringPiece device_name) {
|
||||
return str_util::StartsWith(device_name, worker_name);
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@ limitations under the License.
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/process_util.h"
|
||||
#include "tensorflow/core/common_runtime/profile_handler.h"
|
||||
#include "tensorflow/core/common_runtime/stats_publisher_interface.h"
|
||||
@ -236,7 +235,7 @@ class MasterSession::ReffedClientGraph : public core::RefCounted {
|
||||
const bool is_partial_;
|
||||
const CallableOptions callable_opts_;
|
||||
WorkerCacheInterface* const worker_cache_; // Not owned.
|
||||
std::unordered_map<absl::string_view, Node*, StringPieceHasher> name_to_node_;
|
||||
std::unordered_map<StringPiece, Node*, StringPieceHasher> name_to_node_;
|
||||
const bool should_deregister_;
|
||||
std::atomic<int64> execution_count_ = {0};
|
||||
|
||||
@ -297,14 +296,12 @@ class MasterSession::ReffedClientGraph : public core::RefCounted {
|
||||
// This is a generic method that handles Run, PartialRun, and RunCallable.
|
||||
template <class FetchListType, class ClientRequestType,
|
||||
class ClientResponseType>
|
||||
Status RunPartitionsHelper(const std::unordered_map<absl::string_view, size_t,
|
||||
StringPieceHasher>& feeds,
|
||||
const FetchListType& fetches, const MasterEnv* env,
|
||||
int64 step_id, int64 execution_count,
|
||||
PerStepState* pss, CallOptions* call_opts,
|
||||
const ClientRequestType& req,
|
||||
ClientResponseType* resp, CancellationManager* cm,
|
||||
bool is_last_partial_run);
|
||||
Status RunPartitionsHelper(
|
||||
const std::unordered_map<StringPiece, size_t, StringPieceHasher>& feeds,
|
||||
const FetchListType& fetches, const MasterEnv* env, int64 step_id,
|
||||
int64 execution_count, PerStepState* pss, CallOptions* call_opts,
|
||||
const ClientRequestType& req, ClientResponseType* resp,
|
||||
CancellationManager* cm, bool is_last_partial_run);
|
||||
|
||||
// Deregisters the partitions on the workers. Called in the
|
||||
// destructor and does not wait for the rpc completion.
|
||||
@ -732,7 +729,7 @@ Status MasterSession::ReffedClientGraph::RunPartitions(
|
||||
VLOG(2) << "RunPartitions step_id " << step_id << " execution_count "
|
||||
<< execution_count;
|
||||
// Maps the names of fed tensors to their index in `req`.
|
||||
std::unordered_map<absl::string_view, size_t, StringPieceHasher> feeds(3);
|
||||
std::unordered_map<StringPiece, size_t, StringPieceHasher> feeds(3);
|
||||
for (size_t i = 0; i < req.num_feeds(); ++i) {
|
||||
if (!feeds.insert({req.feed_name(i), i}).second) {
|
||||
return errors::InvalidArgument("Duplicated feeds: ", req.feed_name(i));
|
||||
@ -756,7 +753,7 @@ Status MasterSession::ReffedClientGraph::RunPartitions(
|
||||
VLOG(2) << "RunPartitions step_id " << step_id << " execution_count "
|
||||
<< execution_count;
|
||||
// Maps the names of fed tensors to their index in `req`.
|
||||
std::unordered_map<absl::string_view, size_t, StringPieceHasher> feeds(3);
|
||||
std::unordered_map<StringPiece, size_t, StringPieceHasher> feeds(3);
|
||||
for (size_t i = 0; i < callable_opts_.feed_size(); ++i) {
|
||||
if (!feeds.insert({callable_opts_.feed(i), i}).second) {
|
||||
// MakeCallable will fail if there are two feeds with the same name.
|
||||
|
@ -17,7 +17,6 @@ limitations under the License.
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/device.h"
|
||||
#include "tensorflow/core/common_runtime/process_util.h"
|
||||
#include "tensorflow/core/distributed_runtime/worker_cache.h"
|
||||
@ -34,9 +33,9 @@ namespace tensorflow {
|
||||
// parsing into one place.
|
||||
//
|
||||
// Parses and returns the local device part (e.g., cpu:0, gpu:4).
|
||||
string GetLocalDeviceName(absl::string_view fullname) {
|
||||
string GetLocalDeviceName(StringPiece fullname) {
|
||||
auto pos = fullname.rfind('/');
|
||||
CHECK_NE(pos, absl::string_view::npos);
|
||||
CHECK_NE(pos, StringPiece::npos);
|
||||
fullname.remove_prefix(pos + 1);
|
||||
return string(fullname);
|
||||
}
|
||||
|
@ -119,7 +119,6 @@ cc_library(
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:protos_all_cc",
|
||||
"//tensorflow/core:worker_proto_cc",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -209,7 +208,6 @@ cc_library(
|
||||
"//tensorflow/core:master_proto_cc",
|
||||
"//tensorflow/core/distributed_runtime:call_options",
|
||||
"//tensorflow/core/distributed_runtime:master_interface",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
alwayslink = 1,
|
||||
)
|
||||
@ -228,7 +226,6 @@ cc_library(
|
||||
"//tensorflow/core:lib_internal",
|
||||
"//tensorflow/core:master_proto_cc",
|
||||
"//tensorflow/core/distributed_runtime:master",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
alwayslink = 1,
|
||||
)
|
||||
@ -257,7 +254,6 @@ cc_library(
|
||||
"//tensorflow/core/distributed_runtime:worker_cache",
|
||||
"//tensorflow/core/distributed_runtime:worker_env",
|
||||
"//tensorflow/core/distributed_runtime:worker_interface",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -320,7 +316,6 @@ tf_cc_binary(
|
||||
"//tensorflow/core:protos_all_cc",
|
||||
"//tensorflow/core/distributed_runtime:server_lib",
|
||||
"//tensorflow/core/kernels:data_flow",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -346,7 +341,6 @@ tf_cc_binary(
|
||||
"//tensorflow/core/kernels:matmul_op",
|
||||
"//tensorflow/core/kernels:reduction_ops",
|
||||
"//tensorflow/core/kernels:variable_ops",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@ -485,7 +479,6 @@ tf_cuda_cc_test(
|
||||
"//tensorflow/core/kernels:dense_update_ops",
|
||||
"//tensorflow/core/kernels:matmul_op",
|
||||
"//tensorflow/core/kernels:variable_ops",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -33,7 +33,6 @@ limitations under the License.
|
||||
#include "grpcpp/alarm.h"
|
||||
#include "grpcpp/server_builder.h"
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/distributed_runtime/master.h"
|
||||
#include "tensorflow/core/distributed_runtime/rpc/async_service_interface.h"
|
||||
#include "tensorflow/core/distributed_runtime/rpc/grpc_call.h"
|
||||
@ -287,12 +286,12 @@ class GrpcMasterService : public AsyncServiceInterface {
|
||||
|
||||
// Start tracing, including the ID attached to the RPC.
|
||||
tracing::ScopedActivity* TraceRpc(
|
||||
absl::string_view name,
|
||||
StringPiece name,
|
||||
const std::multimap<::grpc::string_ref, ::grpc::string_ref>& metadata) {
|
||||
absl::string_view id;
|
||||
StringPiece id;
|
||||
auto it = metadata.find(GrpcIdKey());
|
||||
if (it != metadata.end()) {
|
||||
id = absl::string_view(it->second.data(), it->second.size());
|
||||
id = StringPiece(it->second.data(), it->second.size());
|
||||
}
|
||||
return new tracing::ScopedActivity(name, id);
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ limitations under the License.
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/distributed_runtime/call_options.h"
|
||||
#include "tensorflow/core/distributed_runtime/master_interface.h"
|
||||
#include "tensorflow/core/distributed_runtime/rpc/grpc_master_service_impl.h"
|
||||
@ -120,7 +119,7 @@ class GrpcRemoteMaster : public MasterInterface {
|
||||
|
||||
private:
|
||||
// Start tracing, attaching a unique ID to both the trace and the RPC.
|
||||
tracing::ScopedActivity TraceRpc(absl::string_view name,
|
||||
tracing::ScopedActivity TraceRpc(StringPiece name,
|
||||
::grpc::ClientContext* ctx) {
|
||||
string trace_id = strings::StrCat(tracing::GetUniqueArg());
|
||||
ctx->AddMetadata(GrpcIdKey(), trace_id);
|
||||
|
@ -15,7 +15,6 @@ limitations under the License.
|
||||
|
||||
#include "tensorflow/core/distributed_runtime/rpc/grpc_session.h"
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/device.h"
|
||||
#include "tensorflow/core/distributed_runtime/rpc/grpc_testlib.h"
|
||||
#include "tensorflow/core/framework/graph.pb.h"
|
||||
@ -668,7 +667,7 @@ TEST(GrpcSessionTest, LongErrorMessage) {
|
||||
auto a = test::graph::Constant(&g, Tensor());
|
||||
a->set_assigned_device_name(dev_a);
|
||||
std::vector<char> long_string_buffer(1024 * 1024, 'x');
|
||||
absl::string_view long_string(long_string_buffer.data(), 1024 * 1024);
|
||||
StringPiece long_string(long_string_buffer.data(), 1024 * 1024);
|
||||
string name = strings::StrCat(long_string, "fantasia!");
|
||||
auto a_err = test::graph::Error(&g, a, name);
|
||||
a_err->set_assigned_device_name(dev_a);
|
||||
|
@ -16,7 +16,6 @@ limitations under the License.
|
||||
#include "tensorflow/core/distributed_runtime/rpc/grpc_tensor_coding.h"
|
||||
#include "grpcpp/support/byte_buffer.h"
|
||||
#include "grpcpp/support/slice.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/dma_helper.h"
|
||||
#include "tensorflow/core/framework/tensor.h"
|
||||
#include "tensorflow/core/framework/tensor.pb.h"
|
||||
@ -159,7 +158,7 @@ void EncodeTensorToByteBuffer(bool is_dead, const Tensor& val,
|
||||
io::ProtoEncodeHelper e_skeleton(skeleton.data(), skeleton.size());
|
||||
EncodeSkeleton(val, &e_skeleton);
|
||||
|
||||
absl::string_view tdata = val.tensor_data();
|
||||
StringPiece tdata = val.tensor_data();
|
||||
uint32 overall_tensor_proto_bytesize =
|
||||
(e_skeleton.size() +
|
||||
VarLengthEncodingSize(TensorProto::kTensorContentFieldNumber,
|
||||
@ -198,7 +197,7 @@ void EncodeTensorToByteBuffer(bool is_dead, const Tensor& val,
|
||||
e.WriteVarlengthBeginning(RecvTensorResponse::kTensorFieldNumber,
|
||||
overall_tensor_proto_bytesize);
|
||||
// (C)
|
||||
e.WriteRawBytes(absl::string_view(e_skeleton.data(), e_skeleton.size()));
|
||||
e.WriteRawBytes(StringPiece(e_skeleton.data(), e_skeleton.size()));
|
||||
// (D1) & (D2)
|
||||
e.WriteVarlengthBeginning(TensorProto::kTensorContentFieldNumber,
|
||||
tdata.size());
|
||||
|
@ -20,7 +20,6 @@ limitations under the License.
|
||||
#include "grpcpp/security/credentials.h"
|
||||
#include "grpcpp/server_builder.h"
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/distributed_runtime/server_lib.h"
|
||||
|
||||
#include "tensorflow/core/lib/core/errors.h"
|
||||
@ -57,7 +56,7 @@ Status FillServerDef(const string& cluster_spec, const string& job_name,
|
||||
const string& job_name = job_pieces[0];
|
||||
job_def->set_name(job_name);
|
||||
// Does a bit more validation of the tasks_per_replica.
|
||||
const absl::string_view spec = job_pieces[1];
|
||||
const StringPiece spec = job_pieces[1];
|
||||
// job_str is of form <job_name>|<host_ports>.
|
||||
const std::vector<string> host_ports = str_util::Split(spec, ';');
|
||||
for (size_t i = 0; i < host_ports.size(); ++i) {
|
||||
|
@ -19,7 +19,6 @@ limitations under the License.
|
||||
#include "grpcpp/security/credentials.h"
|
||||
#include "grpcpp/server_builder.h"
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/distributed_runtime/server_lib.h"
|
||||
|
||||
#include "tensorflow/core/lib/core/errors.h"
|
||||
@ -51,7 +50,7 @@ Status FillServerDef(const string& job_spec, const string& job_name,
|
||||
CHECK_EQ(2, job_pieces.size()) << job_str;
|
||||
job_def->set_name(job_pieces[0]);
|
||||
// Does a bit more validation of the tasks_per_replica.
|
||||
const absl::string_view spec = job_pieces[1];
|
||||
const StringPiece spec = job_pieces[1];
|
||||
// job_str is of form <job_name>|<host_ports>.
|
||||
const std::vector<string> host_ports = str_util::Split(spec, ';');
|
||||
uint32 tasks_per_replica = host_ports.size();
|
||||
|
@ -17,7 +17,6 @@ limitations under the License.
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/device.h"
|
||||
#include "tensorflow/core/common_runtime/device_mgr.h"
|
||||
#include "tensorflow/core/common_runtime/dma_helper.h"
|
||||
@ -59,7 +58,7 @@ class RpcRecvTensorCall : public BaseRecvTensorCall {
|
||||
public:
|
||||
RpcRecvTensorCall() : wi_(nullptr), dst_device_(nullptr) {}
|
||||
|
||||
void Init(WorkerInterface* wi, int64 step_id, absl::string_view key,
|
||||
void Init(WorkerInterface* wi, int64 step_id, StringPiece key,
|
||||
AllocatorAttributes alloc_attrs, Device* dst_device,
|
||||
const Rendezvous::Args& recv_args, Rendezvous::DoneCallback done) {
|
||||
wi_ = wi;
|
||||
|
@ -17,7 +17,6 @@ limitations under the License.
|
||||
|
||||
#include "google/protobuf/any.pb.h"
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/common_runtime/device.h"
|
||||
#include "tensorflow/core/framework/tensor.pb.h"
|
||||
#include "tensorflow/core/framework/tensor_shape.pb.h"
|
||||
@ -197,7 +196,7 @@ bool TensorResponse::ParseTensorSubmessage(
|
||||
seen_tensor_content = true;
|
||||
TensorShape shape(tensor_meta->tensor_shape());
|
||||
Tensor t(allocator_, tensor_meta->dtype(), shape);
|
||||
absl::string_view buf = t.tensor_data();
|
||||
StringPiece buf = t.tensor_data();
|
||||
if (static_cast<size_t>(num_bytes) != buf.size()) return false;
|
||||
// TODO(jeff,sanjay): Figure out a way to avoid this copy if
|
||||
// the underlying ZeroCopyInputStream data is properly aligned
|
||||
|
@ -104,9 +104,9 @@ limitations under the License.
|
||||
#include <type_traits>
|
||||
|
||||
#include "absl/base/macros.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/example/example.pb.h"
|
||||
#include "tensorflow/core/example/feature.pb.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/platform/protobuf.h"
|
||||
#include "tensorflow/core/platform/types.h"
|
||||
|
||||
@ -170,7 +170,7 @@ template <>
|
||||
struct is_string<string> : std::true_type {};
|
||||
|
||||
template <>
|
||||
struct is_string<::absl::string_view> : std::true_type {};
|
||||
struct is_string<::tensorflow::StringPiece> : std::true_type {};
|
||||
|
||||
template <typename ValueType>
|
||||
struct FeatureTrait<
|
||||
|
@ -18,13 +18,13 @@ limitations under the License.
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/framework/attr_value.pb_text.h"
|
||||
#include "tensorflow/core/framework/tensor.pb_text.h"
|
||||
#include "tensorflow/core/framework/tensor_shape.pb.h"
|
||||
#include "tensorflow/core/framework/types.h"
|
||||
#include "tensorflow/core/framework/types.pb_text.h"
|
||||
#include "tensorflow/core/lib/core/errors.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/lib/hash/hash.h"
|
||||
#include "tensorflow/core/lib/strings/proto_serialization.h"
|
||||
#include "tensorflow/core/lib/strings/str_util.h"
|
||||
@ -187,8 +187,8 @@ string SummarizeString(const string& str) {
|
||||
// If the string is long, replace the middle with ellipses.
|
||||
constexpr int kMaxStringSummarySize = 80;
|
||||
if (escaped.size() >= kMaxStringSummarySize) {
|
||||
absl::string_view prefix(escaped);
|
||||
absl::string_view suffix = prefix;
|
||||
StringPiece prefix(escaped);
|
||||
StringPiece suffix = prefix;
|
||||
prefix.remove_suffix(escaped.size() - 10);
|
||||
suffix.remove_prefix(escaped.size() - 10);
|
||||
return strings::StrCat("\"", prefix, "...", suffix, "\"");
|
||||
@ -288,7 +288,7 @@ string SummarizeAttrValue(const AttrValue& attr_value) {
|
||||
return "<Unknown AttrValue type>"; // Prevent missing return warning
|
||||
}
|
||||
|
||||
Status AttrValueHasType(const AttrValue& attr_value, absl::string_view type) {
|
||||
Status AttrValueHasType(const AttrValue& attr_value, StringPiece type) {
|
||||
int num_set = 0;
|
||||
|
||||
#define VALIDATE_FIELD(name, type_string, oneof_case) \
|
||||
@ -386,8 +386,7 @@ Status AttrValueHasType(const AttrValue& attr_value, absl::string_view type) {
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
bool ParseAttrValue(absl::string_view type, absl::string_view text,
|
||||
AttrValue* out) {
|
||||
bool ParseAttrValue(StringPiece type, StringPiece text, AttrValue* out) {
|
||||
// Parse type.
|
||||
string field_name;
|
||||
bool is_list = str_util::ConsumePrefix(&type, "list(");
|
||||
@ -421,7 +420,7 @@ bool ParseAttrValue(absl::string_view type, absl::string_view text,
|
||||
if (is_list) {
|
||||
// TextFormat parser considers "i: 7" to be the same as "i: [7]",
|
||||
// but we only want to allow list values with [].
|
||||
absl::string_view cleaned = text;
|
||||
StringPiece cleaned = text;
|
||||
str_util::RemoveLeadingWhitespace(&cleaned);
|
||||
str_util::RemoveTrailingWhitespace(&cleaned);
|
||||
if (cleaned.size() < 2 || cleaned[0] != '[' ||
|
||||
@ -474,12 +473,11 @@ DEFINE_SET_ATTR_VALUE_LIST(const std::vector<bool>&, b)
|
||||
DEFINE_SET_ATTR_VALUE_LIST(std::initializer_list<bool>, b)
|
||||
DEFINE_SET_ATTR_VALUE_BOTH(DataType, type)
|
||||
|
||||
void SetAttrValue(absl::string_view value, AttrValue* out) {
|
||||
void SetAttrValue(StringPiece value, AttrValue* out) {
|
||||
out->set_s(value.data(), value.size());
|
||||
}
|
||||
|
||||
void SetAttrValue(const gtl::ArraySlice<absl::string_view> value,
|
||||
AttrValue* out) {
|
||||
void SetAttrValue(const gtl::ArraySlice<StringPiece> value, AttrValue* out) {
|
||||
out->mutable_list()->Clear(); // Create list() even if value empty.
|
||||
for (const auto& v : value) {
|
||||
out->mutable_list()->add_s(v.data(), v.size());
|
||||
|
@ -20,12 +20,12 @@ limitations under the License.
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "tensorflow/core/framework/partial_tensor_shape.h"
|
||||
#include "tensorflow/core/framework/tensor.h"
|
||||
#include "tensorflow/core/framework/tensor_shape.h"
|
||||
#include "tensorflow/core/framework/types.h"
|
||||
#include "tensorflow/core/lib/core/status.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/lib/gtl/array_slice.h"
|
||||
|
||||
namespace tensorflow {
|
||||
@ -39,7 +39,7 @@ class NameAttrList;
|
||||
string SummarizeAttrValue(const AttrValue& attr_value);
|
||||
|
||||
// Generates an error if attr_value doesn't have the indicated attr type.
|
||||
Status AttrValueHasType(const AttrValue& attr_value, absl::string_view type);
|
||||
Status AttrValueHasType(const AttrValue& attr_value, StringPiece type);
|
||||
|
||||
// Converts a text proto value from "text" into the field of *out
|
||||
// indicated by "type" (e.g. from the type field of an AttrDef).
|
||||
@ -48,13 +48,12 @@ Status AttrValueHasType(const AttrValue& attr_value, absl::string_view type);
|
||||
// * If type:"list(string)" and text:"['foo', 'bar']",
|
||||
// then *out is set to "list { s: ['foo', 'bar'] }"
|
||||
// Returns true on success.
|
||||
bool ParseAttrValue(absl::string_view type, absl::string_view text,
|
||||
AttrValue* out);
|
||||
bool ParseAttrValue(StringPiece type, StringPiece text, AttrValue* out);
|
||||
|
||||
// Sets *out based on the type of value.
|
||||
void SetAttrValue(const string& value, AttrValue* out);
|
||||
void SetAttrValue(const char* value, AttrValue* out);
|
||||
void SetAttrValue(absl::string_view value, AttrValue* out);
|
||||
void SetAttrValue(StringPiece value, AttrValue* out);
|
||||
void SetAttrValue(int64 value, AttrValue* out);
|
||||
void SetAttrValue(int32 value, AttrValue* out);
|
||||
void SetAttrValue(float value, AttrValue* out);
|
||||
@ -70,7 +69,7 @@ void SetAttrValue(const NameAttrList& value, AttrValue* out);
|
||||
|
||||
void SetAttrValue(gtl::ArraySlice<string> value, AttrValue* out);
|
||||
void SetAttrValue(gtl::ArraySlice<const char*> value, AttrValue* out);
|
||||
void SetAttrValue(gtl::ArraySlice<absl::string_view> value, AttrValue* out);
|
||||
void SetAttrValue(gtl::ArraySlice<StringPiece> value, AttrValue* out);
|
||||
void SetAttrValue(gtl::ArraySlice<int64> value, AttrValue* out);
|
||||
void SetAttrValue(gtl::ArraySlice<int32> value, AttrValue* out);
|
||||
void SetAttrValue(gtl::ArraySlice<float> value, AttrValue* out);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user