From b2b2424f09e4540afe0a6086c8c833303bbed39e Mon Sep 17 00:00:00 2001 From: Anthony Barbier Date: Mon, 19 Aug 2019 11:05:11 +0100 Subject: [PATCH] Sort map before serializing it --- tensorflow/compiler/xla/service/hlo_instruction.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tensorflow/compiler/xla/service/hlo_instruction.cc b/tensorflow/compiler/xla/service/hlo_instruction.cc index e946e56c82c..1ba87a6da6a 100644 --- a/tensorflow/compiler/xla/service/hlo_instruction.cc +++ b/tensorflow/compiler/xla/service/hlo_instruction.cc @@ -3206,8 +3206,11 @@ StatusOr StringToFusionKind( string FrontendAttributesToString( const FrontendAttributes& frontend_attributes) { - return absl::StrFormat("{%s}", absl::StrJoin(frontend_attributes.map(), ",", - absl::PairFormatter("="))); + std::vector> sorted_attributes( + frontend_attributes.map().begin(), frontend_attributes.map().end()); + std::sort(sorted_attributes.begin(), sorted_attributes.end()); + return absl::StrFormat( + "{%s}", absl::StrJoin(sorted_attributes, ",", absl::PairFormatter("="))); } string PaddingConfigToString(const PaddingConfig& padding) {