(
cls,
weights: torch.Tensor, # [V, D]
epsilon: float = 0.2,
)
| 668 | |
| 669 | @classmethod |
| 670 | def from_weights( |
| 671 | cls, |
| 672 | weights: torch.Tensor, # [V, D] |
| 673 | epsilon: float = 0.2, |
| 674 | ) -> "JLSampler": |
| 675 | k = optimal_k(n=weights.shape[0], epsilon=epsilon) |
| 676 | print(f"JLSampler optimal k={k}") |
| 677 | return cls(weights, k=k) |
| 678 | |
| 679 | def prepare(self) -> "JLSampler": |
| 680 | D = self.weights.shape[1] # noqa: N806 |