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

Function TFE_OpSetAttrShape

tensorflow/c/eager/c_api.cc:712–732  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

710}
711
712void TFE_OpSetAttrShape(TFE_Op* op, const char* attr_name, const int64_t* dims,
713 const int num_dims, TF_Status* out_status) {
714 if (num_dims > tensorflow::TensorShape::MaxDimensions()) {
715 TF_SetStatus(out_status, TF_INVALID_ARGUMENT,
716 tensorflow::strings::StrCat(
717 "Value specified for `", attr_name, "` has ", num_dims,
718 " dimensions which is over the limit of ",
719 tensorflow::TensorShape::MaxDimensions(), ".")
720 .c_str());
721 return;
722 }
723 tensorflow::TensorShapeProto proto;
724 if (num_dims < 0) {
725 proto.set_unknown_rank(true);
726 } else {
727 for (int d = 0; d < num_dims; ++d) {
728 proto.add_dim()->set_size(dims[d]);
729 }
730 }
731 op->operation.MutableAttrs()->Set(attr_name, proto);
732}
733
734void TFE_OpSetAttrFunction(TFE_Op* op, const char* attr_name,
735 const TFE_Op* value) {

Callers 4

SetOpAttrScalarFunction · 0.85
SetOpAttrValueScalarFunction · 0.85
CreateVariableFunction · 0.85

Calls 6

TF_SetStatusFunction · 0.85
c_strMethod · 0.80
MutableAttrsMethod · 0.80
StrCatFunction · 0.50
set_sizeMethod · 0.45
SetMethod · 0.45

Tested by 1

CreateVariableFunction · 0.68