Handle aten.isnan - check for NaN values element-wise. isnan(x) is equivalent to x != x (NaN is the only value not equal to itself).
(P: MLXProgramBuilder, n: Node)
| 428 | |
| 429 | @REGISTRY.register(target=[torch.ops.aten.isnan.default]) |
| 430 | def _isnan_handler(P: MLXProgramBuilder, n: Node) -> Slot: |
| 431 | """Handle aten.isnan - check for NaN values element-wise. |
| 432 | |
| 433 | isnan(x) is equivalent to x != x (NaN is the only value not equal to itself). |
| 434 | """ |
| 435 | args = P.args(n) |
| 436 | require_args(args, 1, 1, "aten.isnan") |
| 437 | require_kwargs(P.kwargs(n), set(), "aten.isnan") |
| 438 | x = args[0] |
| 439 | out = P.make_or_get_slot(n) |
| 440 | P.emit( |
| 441 | NotEqualNode( |
| 442 | a=P.slot_to_tid(x), |
| 443 | b=P.slot_to_tid(x), |
| 444 | out=P.slot_to_tid(out), |
| 445 | ) |
| 446 | ) |
| 447 | return out |
| 448 | |
| 449 | |
| 450 | _BINARY_OPS: List[Tuple[List[Any], Any, str, bool]] = [ |
nothing calls this directly
no test coverage detected