| 2669 | } |
| 2670 | |
| 2671 | Status AlgebraicSimplifierVisitor::HandleIota(HloInstruction* instruction) { |
| 2672 | // iota -> zero if the iota dimension never produces an element other than |
| 2673 | // zero. |
| 2674 | auto* iota = Cast<HloIotaInstruction>(instruction); |
| 2675 | if (iota->shape().dimensions(iota->iota_dimension()) <= 1) { |
| 2676 | auto zero = computation_->AddInstruction( |
| 2677 | simplifier_->CreateConstantWithLayoutUpdated( |
| 2678 | LiteralUtil::Zero(iota->shape().element_type()).Clone())); |
| 2679 | return ReplaceWithNewInstruction( |
| 2680 | iota, HloInstruction::CreateBroadcast(iota->shape(), zero, {})); |
| 2681 | } |
| 2682 | return Status::OK(); |
| 2683 | } |
| 2684 | |
| 2685 | Status AlgebraicSimplifierVisitor::HandlePad(HloInstruction* pad) { |
| 2686 | if (ShapeUtil::IsZeroElementArray(pad->operand(0)->shape())) { |
nothing calls this directly
no test coverage detected