message: Added test cases for PReLU/ELU/ThresholdedReLU parameter validation.
diff: @@ -111,23 +111,53 @@ class AdvancedActivationsTest(keras_parameterized.TestCase):
  def test_leaky_relu_with_invalid_alpha(self):
  # Test case for GitHub issue 46993.
  with self.assertRaisesRegex(ValueError,
  - 'alpha of leaky Relu layer cannot be None'):
  + 'The alpha value of a Leaky ReLU layer cannot '
  + 'be None, needs a float. Got None'):
  testing_utils.layer_test(
  keras.layers.LeakyReLU,
  kwargs={'alpha': None},
  input_shape=(2, 3, 4),
  supports_masking=True)
  - def test_leaky_elu_with_invalid_alpha(self):
  + with self.assertRaisesRegex(ValueError,
  + 'The alpha value of a Leaky ReLU layer should '
  + 'be >=0, got -10'):
  + testing_utils.layer_test(
  + keras.layers.LeakyReLU,
  + kwargs={'alpha': -10},
  + input_shape=(2, 3, 4),
  + supports_masking=True)
  +
  + def test_elu_with_invalid_alpha(self):
  # Test case for GitHub issue 46993.
  with self.assertRaisesRegex(ValueError,
  - 'alpha of ELU layer cannot be None'):
  + 'Alpha of an ELU layer cannot be None, '
  + 'requires a float. Got None'):
  testing_utils.layer_test(
  keras.layers.ELU,
  kwargs={'alpha': None},
  input_shape=(2, 3, 4),
  supports_masking=True)
  + def test_threshold_relu_with_invalid_alpha(self):
  + with self.assertRaisesRegex(ValueError,
  + 'Theta of a Thresholded ReLU layer cannot be None, '
  + 'requires a float. Got None'):
  + testing_utils.layer_test(
  + keras.layers.ThresholdedReLU,
  + kwargs={'theta': None},
  + input_shape=(2, 3, 4),
  + supports_masking=True)
  +
  + with self.assertRaisesRegex(ValueError,
  + 'The theta value of a Thresholded ReLU layer '
  + 'should be >=0, got -10'):
  + testing_utils.layer_test(
  + keras.layers.ThresholdedReLU,
  + kwargs={'theta': -10},
  + input_shape=(2, 3, 4),
  + supports_masking=True)
  +
  if __name__ == '__main__':
  test.main()
  