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
|
||||
|
||||
// Returns ApiDef text representation in multi-line format
|
||||
// Returns ApiDefs text representation in multi-line format
|
||||
// constructed based on the given op.
|
||||
string CreateApiDef(const OpDef& op) {
|
||||
ApiDef api_def;
|
||||
FillBaseApiDef(&api_def, op);
|
||||
ApiDefs api_defs;
|
||||
FillBaseApiDef(api_defs.add_op(), op);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ limitations under the License.
|
||||
|
||||
namespace tensorflow {
|
||||
|
||||
// Returns ApiDef text representation in multi-line format
|
||||
// Returns ApiDefs text representation in multi-line format
|
||||
// constructed based on the given op.
|
||||
string CreateApiDef(const OpDef& op);
|
||||
|
||||
|
@ -173,30 +173,32 @@ description: "Description\nfor Op1."
|
||||
OpDef op;
|
||||
protobuf::TextFormat::ParseFromString(op_text, &op); // NOLINT
|
||||
|
||||
const string expected_api_def = R"(graph_op_name: "Op1"
|
||||
in_arg {
|
||||
name: "a"
|
||||
description: <<END
|
||||
const string expected_api_def = R"(op {
|
||||
graph_op_name: "Op1"
|
||||
in_arg {
|
||||
name: "a"
|
||||
description: <<END
|
||||
Description for a.
|
||||
END
|
||||
}
|
||||
out_arg {
|
||||
name: "output"
|
||||
description: <<END
|
||||
}
|
||||
out_arg {
|
||||
name: "output"
|
||||
description: <<END
|
||||
Description for output.
|
||||
END
|
||||
}
|
||||
attr {
|
||||
name: "b"
|
||||
description: <<END
|
||||
}
|
||||
attr {
|
||||
name: "b"
|
||||
description: <<END
|
||||
Description for b.
|
||||
END
|
||||
}
|
||||
summary: "Summary for Op1."
|
||||
description: <<END
|
||||
}
|
||||
summary: "Summary for Op1."
|
||||
description: <<END
|
||||
Description
|
||||
for Op1.
|
||||
END
|
||||
}
|
||||
)";
|
||||
EXPECT_EQ(expected_api_def, CreateApiDef(op));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user