| 108 | } |
| 109 | |
| 110 | XlaOp IsNegInf(XlaOp operand) { |
| 111 | auto& b = *operand.builder(); |
| 112 | return b.ReportErrorOrReturn([&]() -> StatusOr<XlaOp> { |
| 113 | TF_RETURN_IF_ERROR(EnsureOperandIsRealFp("IsNegInf", operand)); |
| 114 | TF_ASSIGN_OR_RETURN(auto shape, b.GetShape(operand)); |
| 115 | // Note that this is only correct for floating-point types. If we wanted it |
| 116 | // to be correct for all types, we'd need to Lt(MinFiniteValue). |
| 117 | return Eq(operand, MinValue(&b, shape.element_type())); |
| 118 | }); |
| 119 | } |
| 120 | |
| 121 | XlaOp IsInf(XlaOp operand) { |
| 122 | auto& b = *operand.builder(); |