flashinfer.quantization.packbits#

flashinfer.quantization.packbits(x: torch.Tensor, bitorder: str = 'big')#

Pack the elements of a binary-valued array into bits in a uint8 array.

The semantics of this function is the same as numpy.packbits.

Parameters:
  • x (torch.Tensor) – The 1D binary-valued array to pack.

  • bitorder (str) – The bit-order (“bit”/”little”) of the output. Default is “big”.

Returns:

y – An uint8 packed array, shape ((x.size(0) + 7) / 8),).

Return type:

torch.Tensor

See also

segment_packbits