MCPcopy Create free account
hub / github.com/pytorch/executorch / _isnan_handler

Function _isnan_handler

backends/mlx/ops.py:430–447  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

428
429@REGISTRY.register(target=[torch.ops.aten.isnan.default])
430def _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]] = [

Callers

nothing calls this directly

Calls 7

require_argsFunction · 0.85
require_kwargsFunction · 0.85
argsMethod · 0.80
kwargsMethod · 0.80
emitMethod · 0.80
slot_to_tidMethod · 0.80
make_or_get_slotMethod · 0.45

Tested by

no test coverage detected