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

Function TF_OperationGetAttrString

tensorflow/c/c_api.cc:1327–1342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1325}
1326
1327void TF_OperationGetAttrString(TF_Operation* oper, const char* attr_name,
1328 void* value, size_t max_length,
1329 TF_Status* status) {
1330 const auto* attr = GetAttrValue(oper, attr_name, status);
1331 if (TF_GetCode(status) != TF_OK) return;
1332 if (attr->value_case() != tensorflow::AttrValue::kS) {
1333 status->status =
1334 InvalidArgument("Attribute '", attr_name, "' is not a string");
1335 return;
1336 }
1337 if (max_length <= 0) {
1338 return;
1339 }
1340 const auto& s = attr->s();
1341 std::memcpy(value, s.data(), std::min<size_t>(s.length(), max_length));
1342}
1343
1344void TF_OperationGetAttrStringList(TF_Operation* oper, const char* attr_name,
1345 void** values, size_t* lengths,

Callers 1

TEST_FFunction · 0.85

Calls 5

GetAttrValueFunction · 0.85
TF_GetCodeFunction · 0.85
InvalidArgumentFunction · 0.85
dataMethod · 0.45
lengthMethod · 0.45

Tested by 1

TEST_FFunction · 0.68