MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / rotate_half

Function rotate_half

k_diffusion/models/axial_rope.py:13–17  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

11
12
13def rotate_half(x):
14 x1, x2 = x[..., 0::2], x[..., 1::2]
15 x = torch.stack((-x2, x1), dim=-1)
16 *shape, d, r = x.shape
17 return x.view(*shape, d * r)
18
19
20@flags.compile_wrap

Callers 1

apply_rotary_embFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected