Fix update_api_def.sh script to output ApiDefs instead of ApiDef proto.
PiperOrigin-RevId: 183109303
This commit is contained in:
parent
18cb45c1cc
commit
5031e9f169
@ -224,14 +224,14 @@ void RemoveDocs(const std::vector<const OpDef*>& ops,
|
|||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// Returns ApiDef text representation in multi-line format
|
// Returns ApiDefs text representation in multi-line format
|
||||||
// constructed based on the given op.
|
// constructed based on the given op.
|
||||||
string CreateApiDef(const OpDef& op) {
|
string CreateApiDef(const OpDef& op) {
|
||||||
ApiDef api_def;
|
ApiDefs api_defs;
|
||||||
FillBaseApiDef(&api_def, op);
|
FillBaseApiDef(api_defs.add_op(), op);
|
||||||
|
|
||||||
const std::vector<string> multi_line_fields = {"description"};
|
const std::vector<string> multi_line_fields = {"description"};
|
||||||
string new_api_defs_str = api_def.DebugString();
|
string new_api_defs_str = api_defs.DebugString();
|
||||||
return PBTxtToMultiline(new_api_defs_str, multi_line_fields);
|
return PBTxtToMultiline(new_api_defs_str, multi_line_fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ limitations under the License.
|
|||||||
|
|
||||||
namespace tensorflow {
|
namespace tensorflow {
|
||||||
|
|
||||||
// Returns ApiDef text representation in multi-line format
|
// Returns ApiDefs text representation in multi-line format
|
||||||
// constructed based on the given op.
|
// constructed based on the given op.
|
||||||
string CreateApiDef(const OpDef& op);
|
string CreateApiDef(const OpDef& op);
|
||||||
|
|
||||||
|
@ -173,30 +173,32 @@ description: "Description\nfor Op1."
|
|||||||
OpDef op;
|
OpDef op;
|
||||||
protobuf::TextFormat::ParseFromString(op_text, &op); // NOLINT
|
protobuf::TextFormat::ParseFromString(op_text, &op); // NOLINT
|
||||||
|
|
||||||
const string expected_api_def = R"(graph_op_name: "Op1"
|
const string expected_api_def = R"(op {
|
||||||
in_arg {
|
graph_op_name: "Op1"
|
||||||
name: "a"
|
in_arg {
|
||||||
description: <<END
|
name: "a"
|
||||||
|
description: <<END
|
||||||
Description for a.
|
Description for a.
|
||||||
END
|
END
|
||||||
}
|
}
|
||||||
out_arg {
|
out_arg {
|
||||||
name: "output"
|
name: "output"
|
||||||
description: <<END
|
description: <<END
|
||||||
Description for output.
|
Description for output.
|
||||||
END
|
END
|
||||||
}
|
}
|
||||||
attr {
|
attr {
|
||||||
name: "b"
|
name: "b"
|
||||||
description: <<END
|
description: <<END
|
||||||
Description for b.
|
Description for b.
|
||||||
END
|
END
|
||||||
}
|
}
|
||||||
summary: "Summary for Op1."
|
summary: "Summary for Op1."
|
||||||
description: <<END
|
description: <<END
|
||||||
Description
|
Description
|
||||||
for Op1.
|
for Op1.
|
||||||
END
|
END
|
||||||
|
}
|
||||||
)";
|
)";
|
||||||
EXPECT_EQ(expected_api_def, CreateApiDef(op));
|
EXPECT_EQ(expected_api_def, CreateApiDef(op));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user