MCPcopy
hub / github.com/hustvl/Vim / forward

Method forward

vim/rope.py:86–92  ·  view source on GitHub ↗
(self, t, start_index = 0)

Source from the content-addressed store, hash-verified

84 print('======== shape of rope freq', self.freqs_cos.shape, '========')
85
86 def forward(self, t, start_index = 0):
87 rot_dim = self.freqs_cos.shape[-1]
88 end_index = start_index + rot_dim
89 assert rot_dim <= t.shape[-1], f'feature dimension {t.shape[-1]} is not of sufficient size to rotate in all the positions {rot_dim}'
90 t_left, t, t_right = t[..., :start_index], t[..., start_index:end_index], t[..., end_index:]
91 t = (t * self.freqs_cos) + (rotate_half(t) * self.freqs_sin)
92 return torch.cat((t_left, t, t_right), dim = -1)
93
94
95

Callers

nothing calls this directly

Calls 2

rotate_halfFunction · 0.85
catMethod · 0.45

Tested by

no test coverage detected