Qualify uses of std::string

PiperOrigin-RevId: 324233556
Change-Id: I5537b9bd231c0ea1f267406a9b19ec943928e8cd
This commit is contained in:
A. Unique TensorFlower 2020-07-31 10:22:40 -07:00 committed by TensorFlower Gardener
parent b511ad39ba
commit b51bba3486
4 changed files with 27 additions and 26 deletions

View File

@ -46,8 +46,8 @@ namespace tensorflow {
class DeviceNameUtils {
public:
// Returns a fully qualified device name given the parameters.
static string FullName(const string& job, int replica, int task,
const string& type, int id);
static std::string FullName(const std::string& job, int replica, int task,
const std::string& type, int id);
struct ParsedName {
void Clear() {
@ -79,13 +79,13 @@ class DeviceNameUtils {
}
bool has_job = false;
string job;
std::string job;
bool has_replica = false;
int replica = 0;
bool has_task = false;
int task = 0;
bool has_type = false;
string type;
std::string type;
bool has_id = false;
int id = 0;
};
@ -107,7 +107,7 @@ class DeviceNameUtils {
// an error and *canonical_name is set to "".
static Status CanonicalizeDeviceName(StringPiece fullname,
StringPiece basename,
string* canonical_name);
std::string* canonical_name);
// Returns true if "name" specifies any non-trivial constraint on the device.
static bool HasSomeDetails(const ParsedName& name) {
@ -163,11 +163,11 @@ class DeviceNameUtils {
static const ParsedName AddressSpace(const ParsedName& name);
// Returns the local device given its "type" and "id".
static string LocalName(StringPiece type, int id);
static std::string LocalName(StringPiece type, int id);
// Returns a short local device name (cpu:0, gpu:1, etc) based on
// the given fullname.
static string LocalName(StringPiece fullname);
static std::string LocalName(StringPiece fullname);
// If "name" is a valid local device name (cpu:0, gpu:1, etc.),
// fills in parsed.type and parsed.id accordingly. Returns true iff
@ -181,13 +181,14 @@ class DeviceNameUtils {
// component into *device. This function will still return true if
// the task component is empty, but it requires the relative device
// component to be fully specified.
static bool SplitDeviceName(StringPiece name, string* task, string* device);
static bool SplitDeviceName(StringPiece name, std::string* task,
std::string* device);
// Get the task name from ParsedName. Return false if the task component is
// not fully specified.
static bool GetTaskName(const ParsedName& pn, string* task);
static bool GetTaskName(const ParsedName& pn, std::string* task);
static string ParsedNameToString(const ParsedName& pn);
static std::string ParsedNameToString(const ParsedName& pn);
// Returns canonical and legacy full names for the given parsed
// device name 'pn'. The returned string names are often useful to
@ -202,8 +203,8 @@ class DeviceNameUtils {
// Returns name of the CPU:0 device on the same host as the device
// `device_name`.
static Status DeviceNameToCpuDeviceName(const string& device_name,
string* host_device_name);
static Status DeviceNameToCpuDeviceName(const std::string& device_name,
std::string* host_device_name);
};
std::ostream& operator<<(std::ostream& os,

View File

@ -53,12 +53,12 @@ Status CheckValidPadding(Padding padding_type,
// Return the string containing the list of valid padding types, that can be
// used as an Attr() in REGISTER_OP.
string GetPaddingAttrString();
std::string GetPaddingAttrString();
// Like GetPaddingAttrString(), but also includes EXPLICIT.
string GetPaddingAttrStringWithExplicit();
std::string GetPaddingAttrStringWithExplicit();
string GetExplicitPaddingsAttrString();
std::string GetExplicitPaddingsAttrString();
// Sets padding value based on the given string padding value.
Status GetPaddingFromString(StringPiece str_value, Padding* value);

View File

@ -97,18 +97,18 @@ enum FilterTensorFormat {
// Parse tensor format from the given string.
// Return true if the parsing succeeds, and false if it fails.
bool FormatFromString(const string& format_str, TensorFormat* format);
bool FormatFromString(const std::string& format_str, TensorFormat* format);
// Parse tensor format from the given string.
// Return true if the parsing succeeds, and false if it fails.
bool FilterFormatFromString(const string& format_str,
bool FilterFormatFromString(const std::string& format_str,
FilterTensorFormat* format);
// Convert a tensor format into string.
string ToString(TensorFormat format);
std::string ToString(TensorFormat format);
// Convert a filter tensor format into string.
string ToString(FilterTensorFormat format);
std::string ToString(FilterTensorFormat format);
// Returns the number of spatial dims of a tensor of rank 'num_dims' and tensor
// format 'format'.
@ -504,13 +504,13 @@ inline void GetExplicitPaddingForDim(
}
// Return the string that specifies the data format for convnet operations.
string GetConvnetDataFormatAttrString();
string GetConvnet3dDataFormatAttrString();
std::string GetConvnetDataFormatAttrString();
std::string GetConvnet3dDataFormatAttrString();
// Return the string that specifies the filter format for convnet operations.
string GetConvnetFilterFormatAttrString();
string GetConvnet3dFilterFormatAttrString();
string GetConvnetDataFormat2D3DAttrString();
std::string GetConvnetFilterFormatAttrString();
std::string GetConvnet3dFilterFormatAttrString();
std::string GetConvnetDataFormat2D3DAttrString();
// Returns a tensor shape for the specified format and dimension sizes.
// Works for both 2D and 3D operations. The output shapes are as follows:

View File

@ -49,12 +49,12 @@ class MovingAverage {
// Returns a string printing bytes in ptr[0..n). The output looks
// like "00 01 ef cd cd ef".
string PrintMemory(const char* ptr, size_t n);
std::string PrintMemory(const char* ptr, size_t n);
// Given a flattened index into a tensor, computes a string s so that
// StrAppend("tensor", s) is a Python indexing expression. E.g.,
// "tensor", "tensor[i]", "tensor[i, j]", etc.
string SliceDebugString(const TensorShape& shape, const int64 flat);
std::string SliceDebugString(const TensorShape& shape, const int64 flat);
// disable MKL in runtime
#ifdef INTEL_MKL