MCPcopy Create free account
hub / github.com/OpenMOSS/MOSS / rotate_every_two

Function rotate_every_two

models_jittor/utils.py:28–32  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

26 return jt.sin(sinusoid_inp), jt.cos(sinusoid_inp)
27
28def rotate_every_two(x):
29 x1 = x[:, :, :, ::2]
30 x2 = x[:, :, :, 1::2]
31 x = jt.stack((-x2, x1), dim=-1)
32 return x.flatten(-2) # in einsum notation: rearrange(x, '... d j -> ... (d j)')
33
34def duplicate_interleave(m):
35 """

Callers 1

apply_rotary_pos_embFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected