def _construct_weights_with_two_orders(weight_shape: Tuple[int, ...]):
        """Construct two quantized lut weights, represented in different quant/lut orders."""
        nbits = 4
        num_palette = 2**nbits
        indices_np_dtype = types.nptype_from_builtin(types.string_to_builtin(f"uint{nbits}"))
        indices = np.random.randint(low=0, high=num_palette, size=weight_shape).astype(
            indices_np_dtype
        )
        lut_shape = weight_shape + (num_palette, 1)
        int8_lut = np.random.randint(low=0, high=6, size=lut_shape, dtype=np.int8)
        scale = np.float16(2.0).reshape([1] * len(weight_shape))
        offset = np.int8(1).reshape([1] * len(weight_shape))

        lut_weight1 = mb.constexpr_lut_to_dense(indices=indices, lut=int8_lut)
        quantized_lut_weight1 = mb.constexpr_blockwise_shift_scale(
            data=lut_weight1, scale=scale, offset=offset
        )
        quantized_weight2 = mb.constexpr_blockwise_shift_scale(
            data=int8_lut,
            scale=scale.reshape([1] * len(int8_lut.shape)),
            offset=offset.reshape([1] * len(int8_lut.shape)),
        )
        quantized_lut_weight2 = mb.constexpr_lut_to_dense(indices=indices, lut=quantized_weight2)

        return quantized_lut_weight1, quantized_lut_weight2
Construct two quantized lut weights, represented in different quant/lut orders.
coremltools/converters/mil/mil/passes/tests/test_quantization_passes.py