(P: MLXProgramBuilder, n: Node)
| 1970 | |
| 1971 | @REGISTRY.register(target=[torch.ops.aten.item.default]) |
| 1972 | def _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]) |
nothing calls this directly
no test coverage detected