(
self,
q: torch.Tensor,
k: torch.Tensor,
v: torch.Tensor,
)
| 60 | module._is_hf_initialized = True |
| 61 | |
| 62 | def forward( |
| 63 | self, |
| 64 | q: torch.Tensor, |
| 65 | k: torch.Tensor, |
| 66 | v: torch.Tensor, |
| 67 | ) -> torch.Tensor: |
| 68 | q, k, v = (rearrange(x, 'n b h d -> b h n d') for x in (q, k, v)) |
| 69 | |
| 70 | if self.la_feature_map_fn is not None: |
| 71 | q, k = map(self.la_feature_map_fn, (q, k)) |
| 72 | |
| 73 | # expects q: b, h, n, d |
| 74 | output = self._la_impl(q, k, v, get_context_parallel_group()) |
| 75 | |
| 76 | output = self.la_output_norm(output) |
| 77 | output = rearrange(output, 'b h n d -> n b (h d)') |
| 78 | |
| 79 | return output |
nothing calls this directly
no outgoing calls
no test coverage detected