MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / HandleIota

Method HandleIota

tensorflow/compiler/xla/service/algebraic_simplifier.cc:2671–2683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2669}
2670
2671Status 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
2685Status AlgebraicSimplifierVisitor::HandlePad(HloInstruction* pad) {
2686 if (ShapeUtil::IsZeroElementArray(pad->operand(0)->shape())) {

Callers

nothing calls this directly

Calls 8

iota_dimensionMethod · 0.80
ZeroFunction · 0.50
dimensionsMethod · 0.45
shapeMethod · 0.45
AddInstructionMethod · 0.45
CloneMethod · 0.45
element_typeMethod · 0.45

Tested by

no test coverage detected