in bitsandbytes/functional.py [0:0]
def create_linear_map(signed=True, total_bits=8, add_zero=True):
sign = -1.0 if signed else 0.0
total_values = 2**total_bits
if add_zero or total_bits < 8:
# add a zero
# since we simulate less bits by having zeros in the data type, we
# we need to center the quantization around zero and as such lose
# a single value
total_values = 2**total_bits if not signed else 2**total_bits - 1
values = torch.linspace(sign, 1.0, total_values)
gap = 256 - values.numel()
if gap == 0:
return values
else:
l = values.numel() // 2 # noqa: E741
return torch.Tensor(values[:l].tolist() + [0] * gap + values[l:].tolist())