Skip to content

Instantly share code, notes, and snippets.

@JamesHowlettLA
JamesHowlettLA / quantizer.py
Last active September 10, 2019 14:25 — forked from alexiscreuzot/quantizer.py
CoreML quantization
import sys
import coremltools
from coremltools.models.neural_network.quantization_utils import *
def quantize(file, bits, functions):
"""
Processes a file to quantize it for each bit-per-weight
and function listed.
file : Core ML file to process (example : mymodel.mlmodel)
bits : Array of bit per weight (example : [16,8,6,4,2,1])