Merge pull request #29435 from lufol:lukas-fix-4
PiperOrigin-RevId: 256370188
This commit is contained in:
commit
9746ceaf48
tensorflow/python/keras
@ -12,8 +12,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
"""Built-in activation functions.
|
"""Built-in activation functions."""
|
||||||
"""
|
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
@ -287,17 +286,14 @@ def linear(x):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The linear activation: `x`.
|
The linear activation: `x`.
|
||||||
|
|
||||||
Note:
|
|
||||||
Often used as last layer of regression networks.
|
|
||||||
"""
|
"""
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
|
||||||
@keras_export('keras.activations.serialize')
|
@keras_export('keras.activations.serialize')
|
||||||
def serialize(activation):
|
def serialize(activation):
|
||||||
if (hasattr(activation, '__name__')
|
if (hasattr(activation, '__name__') and
|
||||||
and activation.__name__ in _TF_ACTIVATIONS_V2):
|
activation.__name__ in _TF_ACTIVATIONS_V2):
|
||||||
return _TF_ACTIVATIONS_V2[activation.__name__]
|
return _TF_ACTIVATIONS_V2[activation.__name__]
|
||||||
return serialize_keras_object(activation)
|
return serialize_keras_object(activation)
|
||||||
|
|
||||||
@ -322,8 +318,7 @@ def get(identifier):
|
|||||||
return identifier
|
return identifier
|
||||||
elif isinstance(identifier, dict):
|
elif isinstance(identifier, dict):
|
||||||
return deserialize_keras_object(
|
return deserialize_keras_object(
|
||||||
identifier,
|
identifier, printable_module_name='activation')
|
||||||
printable_module_name='activation')
|
|
||||||
else:
|
else:
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
'Could not interpret activation function identifier: {}'.format(
|
'Could not interpret activation function identifier: {}'.format(
|
||||||
|
@ -2284,7 +2284,19 @@ def maximum(x, y):
|
|||||||
y: Tensor or variable.
|
y: Tensor or variable.
|
||||||
|
|
||||||
Returns:
|
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)
|
return math_ops.maximum(x, y)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user