| 19 | |
| 20 | |
| 21 | class ErrorStats(BaseModel): |
| 22 | mean: float |
| 23 | std: float |
| 24 | max: float |
| 25 | min: float |
| 26 | |
| 27 | @classmethod |
| 28 | def from_tensor(cls, tensor: torch.Tensor) -> "ErrorStats": |
| 29 | return cls( |
| 30 | mean=tensor.mean().item(), |
| 31 | std=tensor.std().item(), |
| 32 | max=tensor.max().item(), |
| 33 | min=tensor.min().item(), |
| 34 | ) |
| 35 | |
| 36 | def __str__(self): |
| 37 | return ( |
| 38 | f"mean: {self.mean:.4e}, " |
| 39 | f"std: {self.std:.4e}, " |
| 40 | f"max: {self.max:.4e}, " |
| 41 | f"min: {self.min:.4e}" |
| 42 | ) |
| 43 | |
| 44 | |
| 45 | class CompressionEvalResult(BaseModel): |
nothing calls this directly
no outgoing calls
no test coverage detected