def test_post_build_adapt_update_dataset(self):
    'Test that preproc layers can adapt() after build() is called.'
    input_dataset = tf.data.Dataset.from_tensor_slices(np.array([[1], [2], [3], [4], [5], [0]]))
    input_data = keras.Input(shape=(1,))
    layer = AddingPreprocessingLayer()
    output = layer(input_data)
    model = keras.Model(input_data, output)
    model._run_eagerly = testing_utils.should_run_eagerly()
    layer.adapt(input_dataset)
    self.assertAllEqual([[16], [17], [18]], model.predict([1.0, 2.0, 3.0]))
Test that preproc layers can adapt() after build() is called.
def test_post_build_adapt_update_dataset(self):
    
    input_dataset = tf.data.Dataset.from_tensor_slices(np.array([[1], [2], [3], [4], [5], [0]]))
    input_data = keras.Input(shape=(1,))
    layer = AddingPreprocessingLayer()
    output = layer(input_data)
    model = keras.Model(input_data, output)
    model._run_eagerly = testing_utils.should_run_eagerly()
    layer.adapt(input_dataset)
    self.assertAllEqual([[16], [17], [18]], model.predict([1.0, 2.0, 3.0]))