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

Function _copy_handler

backends/mlx/ops.py:947–964  ·  view source on GitHub ↗

Handle aten.copy - copy data from src to self. Schema: aten::copy(Tensor self, Tensor src, bool non_blocking=False) -> Tensor In functionalized Edge IR, this returns a copy of src (args[1]).

(P: MLXProgramBuilder, n: Node)

Source from the content-addressed store, hash-verified

945
946@REGISTRY.register(target=[torch.ops.aten.copy.default])
947def _copy_handler(P: MLXProgramBuilder, n: Node) -> Slot:
948 """Handle aten.copy - copy data from src to self.
949
950 Schema: aten::copy(Tensor self, Tensor src, bool non_blocking=False) -> Tensor
951 In functionalized Edge IR, this returns a copy of src (args[1]).
952 """
953 args = P.args(n)
954 require_args(args, 2, 2, "aten.copy")
955 require_kwargs(P.kwargs(n), {"non_blocking"}, "aten.copy")
956 src = args[1]
957 out = P.make_or_get_slot(n)
958 P.emit(
959 ContiguousNode(
960 x=P.slot_to_tid(src),
961 out=P.slot_to_tid(out),
962 )
963 )
964 return out
965
966
967@REGISTRY.register(target=[exir_ops.edge.dim_order_ops._clone_dim_order.default])

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