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

Function emit_reverse

backends/mlx/ops.py:4083–4094  ·  view source on GitHub ↗

Reverse a tensor along dim using slice with step=-1.

(in_slot, out_slot)

Source from the content-addressed store, hash-verified

4081 return slice_tmp
4082
4083 def emit_reverse(in_slot, out_slot):
4084 """Reverse a tensor along dim using slice with step=-1."""
4085 P.emit(
4086 SliceNode(
4087 x=P.slot_to_tid(in_slot),
4088 out=P.slot_to_tid(out_slot),
4089 axis=P.to_int_or_vid(dim),
4090 start=rev_start,
4091 stop=rev_stop,
4092 step=-1,
4093 )
4094 )
4095
4096 if 0 in used:
4097 # partition → slice last k → sort ascending → reverse to descending

Callers 1

_topk_handlerFunction · 0.85

Calls 3

emitMethod · 0.80
slot_to_tidMethod · 0.80
to_int_or_vidMethod · 0.80

Tested by

no test coverage detected