Project tensor u to unit basis a.
(u: torch.Tensor, basis: torch.Tensor)
| 98 | |
| 99 | |
| 100 | def project(u: torch.Tensor, basis: torch.Tensor) -> torch.Tensor: |
| 101 | """Project tensor u to unit basis a.""" |
| 102 | unit_u = F.normalize(u, dim=-1) |
| 103 | inner_prod = (unit_u * basis).sum(dim=-1, keepdim=True) |
| 104 | return inner_prod * u |
nothing calls this directly
no outgoing calls
no test coverage detected