Use absl::c_sort instead of std::c_sort.

Best-effort to copy the backend_config over when replacing HloInstructions (But only if the new one is empty)
This commit is contained in:
Anthony Barbier 2019-08-20 11:17:38 +01:00
parent b2b2424f09
commit e65f01242b
2 changed files with 5 additions and 3 deletions

View File

@ -837,8 +837,10 @@ Status HloComputation::ReplaceInstruction(HloInstruction* old_instruction,
if (new_instruction->metadata().op_name().empty()) {
new_instruction->set_metadata(old_instruction->metadata());
}
new_instruction->set_raw_backend_config_string(
old_instruction->raw_backend_config_string());
if (new_instruction->raw_backend_config_string().empty()) {
new_instruction->set_raw_backend_config_string(
old_instruction->raw_backend_config_string());
}
if (new_instruction->frontend_attributes().map().empty()) {
new_instruction->set_frontend_attributes(
old_instruction->frontend_attributes());

View File

@ -3208,7 +3208,7 @@ string FrontendAttributesToString(
const FrontendAttributes& frontend_attributes) {
std::vector<std::pair<string, string>> sorted_attributes(
frontend_attributes.map().begin(), frontend_attributes.map().end());
std::sort(sorted_attributes.begin(), sorted_attributes.end());
absl::c_sort(sorted_attributes);
return absl::StrFormat(
"{%s}", absl::StrJoin(sorted_attributes, ",", absl::PairFormatter("=")));
}