MCPcopy Create free account
hub / github.com/Standard-Intelligence/hertz-dev / rotate_half

Function rotate_half

transformer.py:31–33  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

29
30
31def rotate_half(x):
32 x1, x2 = x.chunk(2, dim=-1)
33 return torch.cat((-x2, x1), dim=-1)
34
35
36def apply_rotary_pos_emb(x, cos, sin, offset: int = 0):

Callers 1

apply_rotary_pos_embFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected