| 3472 | } |
| 3473 | |
| 3474 | Status AlgebraicSimplifierVisitor::HandleRsqrt(HloInstruction* rsqrt) { |
| 3475 | VLOG(10) << "trying transform [rsqrt(Pow(A, -2)) => |A|] " |
| 3476 | << rsqrt->ToString(); |
| 3477 | HloInstruction* rsqrt_operand = rsqrt->mutable_operand(0); |
| 3478 | if (rsqrt_operand->opcode() == HloOpcode::kPower && |
| 3479 | IsAll(rsqrt_operand->operand(1), -2) && |
| 3480 | IsPositive(rsqrt_operand, options_)) { |
| 3481 | return ReplaceWithNewInstruction( |
| 3482 | rsqrt, HloInstruction::CreateUnary(rsqrt->shape(), HloOpcode::kAbs, |
| 3483 | rsqrt_operand->mutable_operand(0))); |
| 3484 | } |
| 3485 | |
| 3486 | VLOG(10) << "trying transform [rsqrt(Divide(1, A)) => sqrt(A)] " |
| 3487 | << rsqrt->ToString(); |
| 3488 | if (rsqrt_operand->opcode() == HloOpcode::kDivide && |
| 3489 | IsAll(rsqrt_operand->operand(0), 1) && |
| 3490 | IsPositive(rsqrt_operand->operand(1), options_)) { |
| 3491 | return ReplaceWithNewInstruction( |
| 3492 | rsqrt, HloInstruction::CreateUnary(rsqrt->shape(), HloOpcode::kSqrt, |
| 3493 | rsqrt_operand->mutable_operand(1))); |
| 3494 | } |
| 3495 | |
| 3496 | return Status::OK(); |
| 3497 | } |
| 3498 | |
| 3499 | Status AlgebraicSimplifierVisitor::HandleDynamicSlice( |
| 3500 | HloInstruction* dynamic_slice) { |
no test coverage detected