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

Method WriteClassDef

tensorflow/cc/framework/cc_op_gen.cc:985–1009  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

983}
984
985void OpInfo::WriteClassDef(WritableFile* cc) const {
986 string class_def;
987 strings::StrAppend(&class_def,
988 GetConstructorDecl(strings::StrCat(op_name, "::"),
989 /* include_attr */ true),
990 " {\n");
991 strings::StrAppend(&class_def, GetConstructorBody());
992 strings::StrAppend(&class_def, "}\n\n");
993
994 if (has_optional_attrs) {
995 strings::StrAppend(&class_def,
996 GetConstructorDecl(strings::StrCat(op_name, "::"),
997 /* include_attr */ false));
998 strings::StrAppend(&class_def, "\n : ", op_name, "(");
999 int i = 0;
1000 for (; i < arg_names.size(); ++i) {
1001 if (i > 0) strings::StrAppend(&class_def, ", ");
1002 strings::StrAppend(&class_def, arg_names[i]);
1003 }
1004 if (i > 0) strings::StrAppend(&class_def, ", ");
1005 strings::StrAppend(&class_def, op_name, "::Attrs()");
1006 strings::StrAppend(&class_def, ") {}\n\n");
1007 }
1008 TF_CHECK_OK(cc->Append(class_def));
1009}
1010
1011void WriteCCOp(const OpDef& graph_op_def, const ApiDef& api_def,
1012 const std::vector<string>& aliases, WritableFile* h,

Callers 1

WriteCCOpFunction · 0.80

Calls 4

StrAppendFunction · 0.50
StrCatFunction · 0.50
sizeMethod · 0.45
AppendMethod · 0.45

Tested by

no test coverage detected