(self)
| 11 | |
| 12 | class KeyLUT: |
| 13 | def __init__(self): |
| 14 | r256 = torch.arange(256, dtype=torch.int64) |
| 15 | r512 = torch.arange(512, dtype=torch.int64) |
| 16 | zero = torch.zeros(256, dtype=torch.int64) |
| 17 | device = torch.device("cpu") |
| 18 | |
| 19 | self._encode = { |
| 20 | device: ( |
| 21 | self.xyz2key(r256, zero, zero, 8), |
| 22 | self.xyz2key(zero, r256, zero, 8), |
| 23 | self.xyz2key(zero, zero, r256, 8), |
| 24 | ) |
| 25 | } |
| 26 | self._decode = {device: self.key2xyz(r512, 9)} |
| 27 | |
| 28 | def encode_lut(self, device=torch.device("cpu")): |
| 29 | if device not in self._encode: |