make_test_function

FullyConnected.make_test_function(force=False)

Creates a function that executes one step of evaluation.

This method can be overridden to support custom evaluation logic. This method is called by Model.evaluate and Model.test_on_batch.

Typically, this method directly controls tf.function and tf.distribute.Strategy settings, and delegates the actual evaluation logic to Model.test_step.

This function is cached the first time Model.evaluate or Model.test_on_batch is called. The cache is cleared whenever Model.compile is called. You can skip the cache and generate again the function with force=True.

Parameters:

force – Whether to regenerate the test function and skip the cached function if available.

Returns:

Function. The function created by this method should accept a tf.data.Iterator, and return a dict containing values that will be passed to tf.keras.Callbacks.on_test_batch_end.