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

Function _item_handler

backends/mlx/ops.py:1972–1986  ·  view source on GitHub ↗
(P: MLXProgramBuilder, n: Node)

Source from the content-addressed store, hash-verified

1970
1971@REGISTRY.register(target=[torch.ops.aten.item.default])
1972def _item_handler(P: MLXProgramBuilder, n: Node) -> Slot:
1973 if not isinstance(n.meta["val"], torch.SymInt):
1974 raise ValueError("item only supported if it returns a SymInt")
1975 args = P.args(n)
1976 require_args(args, 1, 1, "aten.item")
1977 require_kwargs(P.kwargs(n), set(), "aten.item")
1978 (x,) = args
1979 out = P.make_or_get_slot(n)
1980 P.emit(
1981 ItemIntNode(
1982 x=P.slot_to_tid(x),
1983 out=P.slot_to_vid(out),
1984 )
1985 )
1986 return out
1987
1988
1989@REGISTRY.register(target=[operator.getitem])

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected