message: This change allows the Keras layer_test to not run the model compilation and training routine. If the layer being tested outputs strings or integers, compilation will fail (as losses and metrics are not compatible with these outputs).
diff: @@ -70,7 +70,7 @@ def get_test_data(train_samples,
  @test_util.use_deterministic_cudnn
  def layer_test(layer_cls, kwargs=None, input_shape=None, input_dtype=None,
  input_data=None, expected_output=None,
  - expected_output_dtype=None):
  + expected_output_dtype=None, validate_training=True):
  """Test routine for a layer with a single input and single output.
  Arguments:
  @@ -82,6 +82,9 @@ def layer_test(layer_cls, kwargs=None, input_shape=None, input_dtype=None,
  input_data: Numpy array of input data.
  expected_output: Shape tuple for the expected shape of the output.
  expected_output_dtype: Data type expected for the output.
  + validate_training: Whether to attempt to validate training on this layer.
  + This might be set to False for non-differentiable layers that output
  + string or integer values.
  Returns:
  The output data (Numpy array) returned by the layer, for additional
  @@ -169,6 +172,7 @@ def layer_test(layer_cls, kwargs=None, input_shape=None, input_dtype=None,
  # Rebuild the model to avoid the graph being reused between predict() and
  # train(). This was causing some error for layer with Defun as it body.
  # See b/120160788 for more details. This should be mitigated after 2.0.
  + if validate_training:
  model = keras.models.Model(x, layer(x))
  if _thread_local_data.run_eagerly is not None:
  model.compile(
  