aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/hlo_module.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/compiler/xla/service/hlo_module.cc')
-rw-r--r--tensorflow/compiler/xla/service/hlo_module.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_module.cc b/tensorflow/compiler/xla/service/hlo_module.cc
index 93e04eb3db..547f74a0ed 100644
--- a/tensorflow/compiler/xla/service/hlo_module.cc
+++ b/tensorflow/compiler/xla/service/hlo_module.cc
@@ -73,6 +73,8 @@ HloComputation* HloModule::AddComputationInternal(
config_.SetDefaultComputationLayout(
entry_computation_->ComputeProgramShape());
}
+ input_output_alias_config_ = HloInputOutputAliasConfig(
+ entry_computation_->root_instruction()->shape());
}
if (uniquify_identifiers) {
@@ -252,6 +254,9 @@ HloModuleProto HloModule::ToProto() const {
if (has_schedule()) {
*proto.mutable_schedule() = schedule().ToProto().ValueOrDie();
}
+
+ *proto.mutable_input_output_alias() = input_output_alias_config().ToProto();
+
return proto;
}
@@ -328,6 +333,10 @@ StatusOr<std::unique_ptr<HloModule>> HloModule::CreateFromProto(
}
TF_RET_CHECK(module->entry_computation_ != nullptr);
+ TF_ASSIGN_OR_RETURN(module->input_output_alias_config_,
+ HloInputOutputAliasConfig::CreateFromProto(
+ module.get(), proto.input_output_alias()));
+
// Because we didn't uniquify the names or the ids, double-check that the
// instruction and computation names and ids are unique from the proto.
absl::flat_hash_set<string> computation_names;