Skip to content

API

[source]

convert_keras_model function

larq_compute_engine.convert_keras_model(
    model, *, experimental_enable_bitpacked_activations=False
)

Converts a Keras model to TFLite flatbuffer.

Example

tflite_model = convert_keras_model(model)
with open("/tmp/my_model.tflite", "wb") as f:
    f.write(tflite_model)

Arguments

  • model tf.keras.models.Model: The model to convert.
  • experimental_enable_bitpacked_activations bool: Enable an experimental converter optimisation that attempts to reduce intermediate activation memory usage by bitpacking the activation tensor between consecutive binary convolutions where possible.

Returns

The converted data in serialized format.