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:
parent
b2b2424f09
commit
e65f01242b
@ -837,8 +837,10 @@ Status HloComputation::ReplaceInstruction(HloInstruction* old_instruction,
|
|||||||
if (new_instruction->metadata().op_name().empty()) {
|
if (new_instruction->metadata().op_name().empty()) {
|
||||||
new_instruction->set_metadata(old_instruction->metadata());
|
new_instruction->set_metadata(old_instruction->metadata());
|
||||||
}
|
}
|
||||||
new_instruction->set_raw_backend_config_string(
|
if (new_instruction->raw_backend_config_string().empty()) {
|
||||||
old_instruction->raw_backend_config_string());
|
new_instruction->set_raw_backend_config_string(
|
||||||
|
old_instruction->raw_backend_config_string());
|
||||||
|
}
|
||||||
if (new_instruction->frontend_attributes().map().empty()) {
|
if (new_instruction->frontend_attributes().map().empty()) {
|
||||||
new_instruction->set_frontend_attributes(
|
new_instruction->set_frontend_attributes(
|
||||||
old_instruction->frontend_attributes());
|
old_instruction->frontend_attributes());
|
||||||
|
@ -3208,7 +3208,7 @@ string FrontendAttributesToString(
|
|||||||
const FrontendAttributes& frontend_attributes) {
|
const FrontendAttributes& frontend_attributes) {
|
||||||
std::vector<std::pair<string, string>> sorted_attributes(
|
std::vector<std::pair<string, string>> sorted_attributes(
|
||||||
frontend_attributes.map().begin(), frontend_attributes.map().end());
|
frontend_attributes.map().begin(), frontend_attributes.map().end());
|
||||||
std::sort(sorted_attributes.begin(), sorted_attributes.end());
|
absl::c_sort(sorted_attributes);
|
||||||
return absl::StrFormat(
|
return absl::StrFormat(
|
||||||
"{%s}", absl::StrJoin(sorted_attributes, ",", absl::PairFormatter("=")));
|
"{%s}", absl::StrJoin(sorted_attributes, ",", absl::PairFormatter("=")));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user