| 2327 | } |
| 2328 | |
| 2329 | Status LayoutAssignment::AddCopyForOperand(HloInstruction* instruction, |
| 2330 | int64 operand_number) { |
| 2331 | HloInstruction* operand = instruction->mutable_operand(operand_number); |
| 2332 | if (operand->opcode() != HloOpcode::kCopy || operand->user_count() > 1) { |
| 2333 | HloInstruction* copy = |
| 2334 | instruction->parent()->AddInstruction(HloInstruction::CreateUnary( |
| 2335 | operand->shape(), HloOpcode::kCopy, operand)); |
| 2336 | SetupCopiedInstruction(*operand, copy, {}); |
| 2337 | LayoutUtil::ClearLayout(copy->mutable_shape()); |
| 2338 | TF_RETURN_IF_ERROR(instruction->ReplaceOperandWith(operand_number, copy)); |
| 2339 | } |
| 2340 | return Status::OK(); |
| 2341 | } |
| 2342 | |
| 2343 | } // namespace xla |
nothing calls this directly
no test coverage detected