Skip to content

Commit

Permalink
Validate alpha argument in leaky relu
Browse files Browse the repository at this point in the history
  • Loading branch information
SuryanarayanaY committed Oct 24, 2023
1 parent 742a2d0 commit 1b1e5ad
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions keras/layers/activations/leaky_relu.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ def __init__(self, negative_slope=0.3, **kwargs):
"Use `negative_slope` instead."
)
super().__init__(**kwargs)
if negative_slope is None:
if negative_slope is None or negative_slope < 0:
raise ValueError(
"The negative_slope value of a Leaky ReLU layer "
"cannot be None. Expected a float. Received: "
f"negative_slope={negative_slope}"
"cannot be None or negative value. Expected a float."
f" Received: negative_slope={negative_slope}"
)
self.supports_masking = True
self.negative_slope = negative_slope
Expand Down

0 comments on commit 1b1e5ad

Please sign in to comment.