Initialize FP Encoder. Args: base (int): The base for the encoder. precision (int): The precision for the encoder.
(self, base: int = 2, precision: int = 16)
| 34 | __slots__ = {"_precision", "_base", "_scale"} |
| 35 | |
| 36 | def __init__(self, base: int = 2, precision: int = 16): |
| 37 | """Initialize FP Encoder. |
| 38 | |
| 39 | Args: |
| 40 | base (int): The base for the encoder. |
| 41 | precision (int): The precision for the encoder. |
| 42 | """ |
| 43 | self._precision = precision |
| 44 | self._base = base |
| 45 | self._scale = base ** precision |
| 46 | |
| 47 | def encode(self, value: Union[torch.Tensor, float, int]) -> torch.LongTensor: |
| 48 | """Encode a value using the FixedPoint Encoder. |
nothing calls this directly
no outgoing calls
no test coverage detected