@@ -2731,24 +2731,23 @@ void XlaBuilder::AddCalledComputation(const XlaComputation& computation,
27312731
27322732namespace {
27332733
2734- template <typename InstructionType, typename HandleToIndexType,
2735- typename InstructionProtoVectorType>
2734+ template <typename InstructionType>
27362735StatusOr<InstructionType> LookUpInstructionByHandleInternal (
2737- HandleToIndexType & handle_to_index,
2738- InstructionProtoVectorType & instructions, int64 handle) {
2736+ const absl::flat_hash_map<int64, int64> & handle_to_index,
2737+ const std::vector<HloInstructionProto> & instructions, int64 handle) {
27392738 auto it = handle_to_index.find (handle);
27402739 if (it == handle_to_index.end ()) {
27412740 return InvalidArgument (" No XlaOp with handle %d" , handle);
27422741 }
2743- return &instructions[ it->second ] ;
2742+ return const_cast <InstructionType>( &instructions. at ( it->second )) ;
27442743}
27452744
2746- template <typename InstructionType, typename HandleToIndexType,
2747- typename InstructionProtoVectorType, typename OpBuilderType,
2745+ template <typename InstructionType,
2746+ typename OpBuilderType,
27482747 typename BuilderType, typename OpType>
27492748StatusOr<InstructionType> LookUpInstructionInternal (
2750- HandleToIndexType & handle_to_index,
2751- InstructionProtoVectorType & instructions, OpBuilderType op_builder,
2749+ const absl::flat_hash_map<int64, int64> & handle_to_index,
2750+ const std::vector<HloInstructionProto> & instructions, OpBuilderType op_builder,
27522751 BuilderType builder, OpType op_handle) {
27532752 if (op_builder == nullptr ) {
27542753 return InvalidArgument (
0 commit comments