| 207 | In this case, the most significant bit (MSB) indicates the sign (0 for positive, 1 for negative), and the value is adjusted to reflect the two's complement format. |
| 208 | """ |
| 209 | def __init__(self, is_bidirectional: bool = False, is_two_complement: bool = False): |
| 210 | super().__init__() |
| 211 | self.T = None |
| 212 | self.x_remain = None |
| 213 | self.spike_seq = None |
| 214 | self._bit_idx = 0 |
| 215 | self.is_bidirectional = is_bidirectional |
| 216 | self.is_bitwise_coding = True |
| 217 | self.is_two_complement = is_two_complement |
| 218 | |
| 219 | def forward(self, x: torch.Tensor, T: int | None = None): |
| 220 | if not torch.allclose(x, x.round()): |