(x: Tensor, K: int = 4)
| 141 | |
| 142 | |
| 143 | def knn(x: Tensor, K: int = 4) -> Tensor: |
| 144 | x_np = x.cpu().numpy() |
| 145 | model = NearestNeighbors(n_neighbors=K, metric="euclidean").fit(x_np) |
| 146 | distances, _ = model.kneighbors(x_np) |
| 147 | return torch.from_numpy(distances).to(x) |
| 148 | |
| 149 | |
| 150 | def rgb_to_sh(rgb: Tensor) -> Tensor: |
no outgoing calls
no test coverage detected