8.1.1.2.1.3.1.1. blueoil.converter.modules.packer

Packer module.

8.1.1.2.1.3.1.1.1. Module Contents

8.1.1.2.1.3.1.1.1.1. Classes

Packer

Packer class packs small integer values to dense unsigned integer (uint8 or uint32).

class blueoil.converter.modules.packer.Packer(bitwidth: int, wordsize: int)

Packer class packs small integer values to dense unsigned integer (uint8 or uint32).

_pack_to_word(self, v)
run(self, tensor: np.ndarray, data_format: str = 'NHWC') → np.ndarray

Pack a tensor.

Parameters
  • tensor (np.ndarray) – Input tensor.

  • data_format (str) – Order of dimension. This defaults to ‘NHWC’, where ‘N’ is the number of kernels, ‘H’ and ‘W’ are the height and width, and ‘C’ is the number of channels.

Returns

Quantized tensor.

Return type

np.ndarray