Missed TensorFlow World? Check out the recap. Learn more

tff.learning.from_compiled_keras_model

View source on GitHub

Builds a tff.learning.Model for an example mini batch.

tff.learning.from_compiled_keras_model(
    keras_model,
    dummy_batch
)

Used in the tutorials:

Args:

  • keras_model: A tf.keras.Model object that was compiled.
  • dummy_batch: A nested structure of values that are convertible to batched tensors with the same shapes and types as expected by forward_pass(). The values of the tensors are not important and can be filled with any reasonable input value.

Returns:

A tff.learning.Model.

Raises:

  • TypeError: If keras_model is not an instance of tf.keras.Model.
  • ValueError: If keras_model was not compiled.