Skip to content

Commit

Permalink
CLN: fix merge error
Browse files Browse the repository at this point in the history
  • Loading branch information
facaiy committed Sep 12, 2018
1 parent b2896c3 commit 2dd5fb6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions tensorflow/contrib/losses/python/losses/loss_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,9 +585,10 @@ 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),
name="value")
term1 = 2.0 * math_ops.div_no_nan(
sum_squares_diff_per_batch,
math_ops.maximum(num_present_per_batch, 0),
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),
Expand Down
4 changes: 2 additions & 2 deletions tensorflow/contrib/metrics/python/ops/metric_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -3904,8 +3904,8 @@ def _calculate_k(po, pe_row, pe_col, name):
total = math_ops.reduce_sum(pe_row)
pe_sum = math_ops.reduce_sum(
math_ops.div_no_nan(
pe_row * pe_col,
math_ops.maximum(total, 0),
math_ops.to_double(pe_row * pe_col),
math_ops.to_double(total),
name=None))
po_sum, pe_sum, total = (math_ops.to_double(po_sum),
math_ops.to_double(pe_sum),
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/contrib/rate/rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,5 @@ def call(self, values, denominator):
state_ops.assign(self.prev_denominator, denominator)

return math_ops.div_no_nan(self.numer,
math_op.maximum(self.denom, 0),
math_ops.maximum(self.denom, 0),
name="safe_rate")
1 change: 0 additions & 1 deletion tensorflow/python/kernel_tests/losses_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import numpy as np

from tensorflow.python.eager import context
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import errors_impl
Expand Down
3 changes: 2 additions & 1 deletion tensorflow/python/ops/losses/losses_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,8 @@ def mean_pairwise_squared_error(
term2 = 2.0 * math_ops.div_no_nan(
math_ops.square(sum_diff),
math_ops.maximum(
math_ops.multiply(num_present_per_batch, num_present_per_batch - 1),
math_ops.multiply(num_present_per_batch,
num_present_per_batch - 1),
0),
name="value")

Expand Down

0 comments on commit 2dd5fb6

Please sign in to comment.