aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/linear_optimizer
diff options
context:
space:
mode:
authorGravatar Yifei Feng <yifeif@google.com>2018-02-09 16:02:24 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-02-09 16:06:00 -0800
commit940540ae4f6d9333dea693aaeabdd18996ed957b (patch)
treeb66bc2884cebec48eca1b47df9787540b8213210 /tensorflow/contrib/linear_optimizer
parent2adb6bbb1b4d31bba7113a4213bf5e7f0e154c78 (diff)
Add pylint check for W0622 redefined-builtin in ci_sanity.sh and fix existing pylint errors.
PiperOrigin-RevId: 185206494
Diffstat (limited to 'tensorflow/contrib/linear_optimizer')
-rw-r--r--tensorflow/contrib/linear_optimizer/python/ops/sdca_ops.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/tensorflow/contrib/linear_optimizer/python/ops/sdca_ops.py b/tensorflow/contrib/linear_optimizer/python/ops/sdca_ops.py
index 7526f3ae0d..3f5fdc18bb 100644
--- a/tensorflow/contrib/linear_optimizer/python/ops/sdca_ops.py
+++ b/tensorflow/contrib/linear_optimizer/python/ops/sdca_ops.py
@@ -211,9 +211,8 @@ class SdcaModel(object):
sums.append(
math_ops.reduce_sum(
math_ops.abs(math_ops.cast(weights, dtypes.float64))))
- sum = math_ops.add_n(sums)
# SDCA L1 regularization cost is: l1 * sum(|weights|)
- return self._options['symmetric_l1_regularization'] * sum
+ return self._options['symmetric_l1_regularization'] * math_ops.add_n(sums)
def _l2_loss(self, l2):
"""Computes the (un-normalized) l2 loss of the model."""
@@ -225,9 +224,8 @@ class SdcaModel(object):
sums.append(
math_ops.reduce_sum(
math_ops.square(math_ops.cast(weights, dtypes.float64))))
- sum = math_ops.add_n(sums)
# SDCA L2 regularization cost is: l2 * sum(weights^2) / 2
- return l2 * sum / 2.0
+ return l2 * math_ops.add_n(sums) / 2.0
def _convert_n_to_tensor(self, input_list, as_ref=False):
"""Converts input list to a set of tensors."""