MCPcopy Create free account
hub / github.com/OpenMined/SyMPC / __init__

Method __init__

src/sympc/encoder/fp_encoder.py:36–45  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected