ensures compatibility with older quant state scheme with nested lists. assumes the following layout: state = [qabsmax, input_shape, A.dtype, blocksize, [offset, state2], quant_type] state2 = [absmax, input_shape, A.dtype, blocksize, None, quant_type]
(self, idx)
| 471 | raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'") |
| 472 | |
| 473 | def __getitem__(self, idx): |
| 474 | """ |
| 475 | ensures compatibility with older quant state scheme with nested lists. |
| 476 | assumes the following layout: |
| 477 | state = [qabsmax, input_shape, A.dtype, blocksize, [offset, state2], quant_type] |
| 478 | state2 = [absmax, input_shape, A.dtype, blocksize, None, quant_type] |
| 479 | """ |
| 480 | if self.nested: |
| 481 | list_repr = [ |
| 482 | self.absmax, |
| 483 | self.shape, |
| 484 | self.dtype, |
| 485 | self.blocksize, |
| 486 | [self.offset, self.state2], |
| 487 | self.quant_type, |
| 488 | ] |
| 489 | else: |
| 490 | list_repr = [self.absmax, self.shape, self.dtype, self.blocksize, None, self.quant_type] |
| 491 | return list_repr[idx] |
| 492 | |
| 493 | @classmethod |
| 494 | def from_dict(cls, qs_dict: dict[str, Any], device: torch.device) -> "QuantState": |
nothing calls this directly
no outgoing calls
no test coverage detected