diff options
author | Yan Facai (颜发才) <facai.yan@gmail.com> | 2018-09-12 14:59:44 +0800 |
---|---|---|
committer | Yan Facai (颜发才) <facai.yan@gmail.com> | 2018-09-12 14:59:44 +0800 |
commit | e3c334e57fba9afc0b0a3aa5f7787ee35e17ddf6 (patch) | |
tree | ab2f4f052a61b8f7b300b654263caab721d91e25 /tensorflow/contrib/losses | |
parent | 2dd5fb6cfb16ccc612b6e278d6282ef90581c0bb (diff) |
CLN: remove unnecessary math_ops.maximum
Diffstat (limited to 'tensorflow/contrib/losses')
-rw-r--r-- | tensorflow/contrib/losses/python/losses/loss_ops.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/tensorflow/contrib/losses/python/losses/loss_ops.py b/tensorflow/contrib/losses/python/losses/loss_ops.py index 66322140cb..7e5ab05987 100644 --- a/tensorflow/contrib/losses/python/losses/loss_ops.py +++ b/tensorflow/contrib/losses/python/losses/loss_ops.py @@ -78,9 +78,7 @@ def _safe_mean(losses, num_present): then zero is returned. """ total_loss = math_ops.reduce_sum(losses) - return math_ops.div_no_nan(total_loss, - math_ops.maximum(num_present, 0), - name="value") + return math_ops.div_no_nan(total_loss, num_present, name="value") @deprecated("2016-12-30", "Use tf.losses.compute_weighted_loss instead.") @@ -585,10 +583,9 @@ def mean_pairwise_squared_error(predictions, math_ops.square(diffs), reduction_indices=reduction_indices) num_present_per_batch = _num_present(diffs, weights, per_batch=True) - term1 = 2.0 * math_ops.div_no_nan( - sum_squares_diff_per_batch, - math_ops.maximum(num_present_per_batch, 0), - name="value") + term1 = 2.0 * math_ops.div_no_nan(sum_squares_diff_per_batch, + num_present_per_batch, + name="value") sum_diff = math_ops.reduce_sum(diffs, reduction_indices=reduction_indices) term2 = 2.0 * math_ops.div_no_nan(math_ops.square(sum_diff), |