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

Function TF_OperationGetAttrTensorShapeProtoList

tensorflow/c/c_api.cc:1455–1478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1453}
1454
1455void TF_OperationGetAttrTensorShapeProtoList(TF_Operation* oper,
1456 const char* attr_name,
1457 TF_Buffer** values, int max_values,
1458 TF_Status* status) {
1459 const auto* attr = GetAttrValue(oper, attr_name, status);
1460 if (TF_GetCode(status) != TF_OK) return;
1461 if (attr->value_case() != tensorflow::AttrValue::kList) {
1462 status->status =
1463 InvalidArgument("Value for '", attr_name, "' is not a list");
1464 return;
1465 }
1466 const auto len = std::min(max_values, attr->list().shape_size());
1467 for (int i = 0; i < len; ++i) {
1468 values[i] = TF_NewBuffer();
1469 status->status = MessageToBuffer(attr->list().shape(i), values[i]);
1470 if (TF_GetCode(status) != TF_OK) {
1471 // Delete everything allocated to far, the operation has failed.
1472 for (int j = 0; j <= i; ++j) {
1473 TF_DeleteBuffer(values[j]);
1474 }
1475 return;
1476 }
1477 }
1478}
1479
1480void TF_OperationGetAttrTensor(TF_Operation* oper, const char* attr_name,
1481 TF_Tensor** value, TF_Status* status) {

Callers 1

TEST_FFunction · 0.85

Calls 9

GetAttrValueFunction · 0.85
TF_GetCodeFunction · 0.85
InvalidArgumentFunction · 0.85
TF_NewBufferFunction · 0.85
MessageToBufferFunction · 0.85
TF_DeleteBufferFunction · 0.85
listMethod · 0.80
minFunction · 0.50
shapeMethod · 0.45

Tested by 1

TEST_FFunction · 0.68