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

Function ConsumeJobName

tensorflow/core/util/device_name_utils.cc:42–56  ·  view source on GitHub ↗

Returns true and fills in "*job" iff "*in" starts with a job name.

Source from the content-addressed store, hash-verified

40
41// Returns true and fills in "*job" iff "*in" starts with a job name.
42static bool ConsumeJobName(StringPiece* in, string* job) {
43 if (in->empty()) return false;
44 if (!IsAlpha((*in)[0])) return false;
45 size_t i = 1;
46 for (; i < in->size(); ++i) {
47 const char c = (*in)[i];
48 if (c == '/') break;
49 if (!(IsAlphaNum(c) || c == '_')) {
50 return false;
51 }
52 }
53 job->assign(in->data(), i);
54 in->remove_prefix(i);
55 return true;
56}
57
58// Returns true and fills in "*device_type" iff "*in" starts with a device type
59// name.

Callers 1

ParseFullNameMethod · 0.85

Calls 6

IsAlphaFunction · 0.70
IsAlphaNumFunction · 0.70
emptyMethod · 0.45
sizeMethod · 0.45
assignMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected