INNER CODE UNIT · Python

power_two

lucidrains/vector-quantize-pytorch · vector_quantize_pytorch/binary_mapper.py:57

        power_two = 2 ** arange(bits)
        codes = (arange(self.num_codes)[:, None].bitwise_and(power_two) != 0).byte().bool()

        self.register_buffer('power_two', power_two, persistent = False)
        self.register_buffer('codes', codes, persistent = False)

        # aux loss

        self.kl_loss_threshold = kl_loss_threshold
        self.register_buffer('zero', tensor(0.), persistent = False)

        # eval behavior

        self.deterministic_on_eval = deterministic_on_eval

    def binary_entropy(self, logits):
        return binary_entropy(logits)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…