MCPcopy Create free account
hub / github.com/MeiGen-AI/MultiTalk / rotate_half

Function rotate_half

wan/utils/multitalk_utils.py:147–151  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

145
146
147def rotate_half(x):
148 x = rearrange(x, "... (d r) -> ... d r", r=2)
149 x1, x2 = x.unbind(dim=-1)
150 x = torch.stack((-x2, x1), dim=-1)
151 return rearrange(x, "... d r -> ... (d r)")
152
153
154class RotaryPositionalEmbedding1D(nn.Module):

Callers 1

forwardMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected