Merge pull request #29435 from lufol:lukas-fix-4

PiperOrigin-RevId: 256370188
This commit is contained in:
TensorFlower Gardener 2019-07-03 08:34:37 -07:00
commit 9746ceaf48
2 changed files with 17 additions and 10 deletions

View File

@ -12,8 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Built-in activation functions.
"""
"""Built-in activation functions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
@ -287,17 +286,14 @@ def linear(x):
Returns:
The linear activation: `x`.
Note:
Often used as last layer of regression networks.
"""
return x
@keras_export('keras.activations.serialize')
def serialize(activation):
if (hasattr(activation, '__name__')
and activation.__name__ in _TF_ACTIVATIONS_V2):
if (hasattr(activation, '__name__') and
activation.__name__ in _TF_ACTIVATIONS_V2):
return _TF_ACTIVATIONS_V2[activation.__name__]
return serialize_keras_object(activation)
@ -322,8 +318,7 @@ def get(identifier):
return identifier
elif isinstance(identifier, dict):
return deserialize_keras_object(
identifier,
printable_module_name='activation')
identifier, printable_module_name='activation')
else:
raise TypeError(
'Could not interpret activation function identifier: {}'.format(

View File

@ -2284,7 +2284,19 @@ def maximum(x, y):
y: Tensor or variable.
Returns:
A tensor.
A tensor with the element wise maximum value(s) of `x` and `y`.
Examples:
```python
# maximum of two tensors
>>> x = tf.Variable([[1, 2], [3, 4]])
>>> y = tf.Variable([[2, 1], [0, -1]])
>>> m = tf.keras.backend.maximum(x, y)
>>> m
<tf.Tensor: id=42, shape=(2, 2), dtype=int32, numpy=
array([[2, 2],
[3, 4]], dtype=int32)>
```
"""
return math_ops.maximum(x, y)