Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahulremanan/7f6c190efe19cf1ae0a15ba90fe63799 to your computer and use it in GitHub Desktop.
Save rahulremanan/7f6c190efe19cf1ae0a15ba90fe63799 to your computer and use it in GitHub Desktop.
A simple inference API for the post-training dynamic range model quantization
class TfLiteModel():
def __init__(self, model):
self.model = model
def predict(self, X, **kwargs):
_tflite_model = dynamic_range_quantize_model(self.model)
_x = np.asarray(X); assert len(X.shape)>=2
_tflite_out_preds = list(map(lambda i : tflite_preds(np.expand_dims(_x[i,:],axis=0), _tflite_model), range(_x.shape[0]) ))
return np.asarray(_tflite_out_preds)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment