def _unpack_on_row(tensor: "NDArray") -> "NDArray":
        """Unpack uint8 into two uint4 (stored in uint8) column wise."""
        # two uint4 packed into one uint8
        # right 4 bits are the first uint4
        shifts = np.array([0, 4])

        # unpack the uint8
        tensor = np.right_shift(tensor[:, :, None], shifts[None, None, :]).astype(np.uint8)
        # mask out the first 4 bits
        tensor &= 0xF
        return tensor.reshape(tensor.shape[0], -1)
Unpack uint8 into two uint4 (stored in uint8) column wise.
olive/passes/onnx/mnb_to_qdq.py