adding comment.
diff --git a/tensorflow/python/keras/backend.py b/tensorflow/python/keras/backend.py
index 6c3e70a..121725f 100644
--- a/tensorflow/python/keras/backend.py
+++ b/tensorflow/python/keras/backend.py
@@ -4541,10 +4541,10 @@
Returns:
A tensor.
"""
- if hasattr(x, "dtype"):
- dtype = x.dtype
- else:
- dtype = floatx()
+ # While x can be a tensor or variable, we also see cases where
+ # numpy arrays, lists, tuples are passed as well.
+ # lists, tuples do not have 'dtype' attribute.
+ dtype = getattr(x, 'dtype', floatx())
if alpha != 0.:
if max_value is None and threshold == 0:
return nn.leaky_relu(x, alpha=alpha)