MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / IsJobName

Function IsJobName

tensorflow/core/util/device_name_utils.cc:32–39  ·  view source on GitHub ↗

Returns true iff "in" is a valid job name.

Source from the content-addressed store, hash-verified

30
31// Returns true iff "in" is a valid job name.
32static bool IsJobName(StringPiece in) {
33 if (in.empty()) return false;
34 if (!IsAlpha(in[0])) return false;
35 for (size_t i = 1; i < in.size(); ++i) {
36 if (!(IsAlphaNum(in[i]) || in[i] == '_')) return false;
37 }
38 return true;
39}
40
41// Returns true and fills in "*job" iff "*in" starts with a job name.
42static bool ConsumeJobName(StringPiece* in, string* job) {

Callers 1

DeviceNameFunction · 0.85

Calls 4

IsAlphaFunction · 0.70
IsAlphaNumFunction · 0.70
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected