TODO(jlebar): Use this function in more places in this file to restrict the domain of other functions.
| 85 | // TODO(jlebar): Use this function in more places in this file to restrict the |
| 86 | // domain of other functions. |
| 87 | static Status EnsureOperandIsRealFp(absl::string_view op_name, XlaOp operand) { |
| 88 | auto& b = *operand.builder(); |
| 89 | TF_ASSIGN_OR_RETURN(auto shape, b.GetShape(operand)); |
| 90 | auto elem_ty = shape.element_type(); |
| 91 | if (!primitive_util::IsFloatingPointType(elem_ty)) { |
| 92 | return InvalidArgument( |
| 93 | "Operands to %s must be real-valued floating-point, but got %s", |
| 94 | op_name, PrimitiveType_Name(elem_ty)); |
| 95 | } |
| 96 | return Status::OK(); |
| 97 | } |
| 98 | |
| 99 | XlaOp IsPosInf(XlaOp operand) { |
| 100 | auto& b = *operand.builder(); |
no test coverage detected