Stay organized with collections Save and categorize content based on your preferences.

Converts a tf.keras.Model to a tff.learning.models.FunctionalModel.

keras_model A tf.keras.Model object, should be uncompiled. If compiled, the metrics, optimizer, and loss function will be ignored. Note: models that have multiple outputs will send all outputs to the loss_fn.
loss_fn A tf.keras.losses.Loss object.
input_spec A structure of tf.TensorSpec defining the input to the model.
metrics_constructor An optional callable that must be compatible with tff.learning.metrics.create_functional_metric_fns.

A tff.learning.models.FunctionalModel.

KerasFunctionalModelError the model has a batch normalization layer.