Handle aten.std - standard deviation of elements along axes.
(P: MLXProgramBuilder, n: Node)
| 3315 | |
| 3316 | @REGISTRY.register(target=[torch.ops.aten.std.correction]) |
| 3317 | def _std_handler(P: MLXProgramBuilder, n: Node) -> Slot: |
| 3318 | """Handle aten.std - standard deviation of elements along axes.""" |
| 3319 | args = P.args(n) |
| 3320 | require_args(args, 1, 2, "aten.std") |
| 3321 | require_kwargs(P.kwargs(n), {"correction", "keepdim"}, "aten.std") |
| 3322 | x = args[0] |
| 3323 | axes, _ = normalize_reduction_dim(args) |
| 3324 | |
| 3325 | correction = n.kwargs.get("correction", None) |
| 3326 | keepdim = n.kwargs.get("keepdim", False) |
| 3327 | ddof = int(correction) if correction is not None else 1 |
| 3328 | |
| 3329 | out = P.make_or_get_slot(n) |
| 3330 | P.emit( |
| 3331 | StdNode( |
| 3332 | x=P.slot_to_tid(x), |
| 3333 | out=P.slot_to_tid(out), |
| 3334 | axes=axes, |
| 3335 | keepdims=keepdim, |
| 3336 | ddof=ddof, |
| 3337 | ) |
| 3338 | ) |
| 3339 | return out |
| 3340 | |
| 3341 | |
| 3342 | @REGISTRY.register(target=[torch.ops.aten.max.default]) |
nothing calls this directly
no test coverage detected