aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Sergio Guadarrama <sguada@google.com>2018-03-08 09:32:53 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-03-08 09:36:50 -0800
commit631a496f756a1a92c63dc8758d0471e38b930fc4 (patch)
tree171b4c903897f6d952b4cff860ce990aefc19fcc
parent55cbd319ac0e4bf463c470d0effceac11ec4dfbc (diff)
Automated g4 rollback of changelist 188265500
PiperOrigin-RevId: 188343238
-rw-r--r--tensorflow/python/framework/tensor_shape.py81
-rw-r--r--tensorflow/python/framework/tensor_shape_test.py13
2 files changed, 7 insertions, 87 deletions
diff --git a/tensorflow/python/framework/tensor_shape.py b/tensorflow/python/framework/tensor_shape.py
index d2dad313f8..6f2ab8408e 100644
--- a/tensorflow/python/framework/tensor_shape.py
+++ b/tensorflow/python/framework/tensor_shape.py
@@ -156,7 +156,7 @@ class Dimension(object):
```
Args:
- other: Another Dimension, or a value accepted by `as_dimension`.
+ other: Another Dimension.
Returns:
A Dimension whose value is the sum of `self` and `other`.
@@ -167,17 +167,6 @@ class Dimension(object):
else:
return Dimension(self._value + other.value)
- def __radd__(self, other):
- """Returns the sum of `other` and `self`.
-
- Args:
- other: Another Dimension, or a value accepted by `as_dimension`.
-
- Returns:
- A Dimension whose value is the sum of `self` and `other`.
- """
- return self + other
-
def __sub__(self, other):
"""Returns the subtraction of `other` from `self`.
@@ -191,10 +180,10 @@ class Dimension(object):
```
Args:
- other: Another Dimension, or a value accepted by `as_dimension`.
+ other: Another Dimension.
Returns:
- A Dimension whose value is the subtraction of `other` from `self`.
+ A Dimension whose value is the subtraction of sum of `other` from `self`.
"""
other = as_dimension(other)
if self._value is None or other.value is None:
@@ -202,21 +191,6 @@ class Dimension(object):
else:
return Dimension(self._value - other.value)
- def __rsub__(self, other):
- """Returns the subtraction of `self` from `other`.
-
- Args:
- other: Another Dimension, or a value accepted by `as_dimension`.
-
- Returns:
- A Dimension whose value is the subtraction of `self` from `other`.
- """
- other = as_dimension(other)
- if self._value is None or other.value is None:
- return Dimension(None)
- else:
- return Dimension(other.value - self._value)
-
def __mul__(self, other):
"""Returns the product of `self` and `other`.
@@ -230,7 +204,7 @@ class Dimension(object):
```
Args:
- other: Another Dimension, or a value accepted by `as_dimension`.
+ other: Another Dimension.
Returns:
A Dimension whose value is the product of `self` and `other`.
@@ -241,17 +215,6 @@ class Dimension(object):
else:
return Dimension(self._value * other.value)
- def __rmul__(self, other):
- """Returns the product of `self` and `other`.
-
- Args:
- other: Another Dimension, or a value accepted by `as_dimension`.
-
- Returns:
- A Dimension whose value is the product of `self` and `other`.
- """
- return self * other
-
def __floordiv__(self, other):
"""Returns the quotient of `self` and `other` rounded down.
@@ -265,7 +228,7 @@ class Dimension(object):
```
Args:
- other: Another Dimension, or a value accepted by `as_dimension`.
+ other: Another `Dimension`.
Returns:
A `Dimension` whose value is the integer quotient of `self` and `other`.
@@ -276,21 +239,6 @@ class Dimension(object):
else:
return Dimension(self._value // other.value)
- def __rfloordiv__(self, other):
- """Returns the quotient of `other` and `self` rounded down.
-
- Args:
- other: Another Dimension, or a value accepted by `as_dimension`.
-
- Returns:
- A `Dimension` whose value is the integer quotient of `self` and `other`.
- """
- other = as_dimension(other)
- if self._value is None or other.value is None:
- return Dimension(None)
- else:
- return Dimension(other.value // self._value)
-
def __div__(self, other):
"""DEPRECATED: Use `__floordiv__` via `x // y` instead.
@@ -308,7 +256,7 @@ class Dimension(object):
return self // other
def __mod__(self, other):
- """Returns `self` modulo `other`.
+ """Returns `self` modulo `other.
Dimension moduli are computed as follows:
@@ -320,7 +268,7 @@ class Dimension(object):
```
Args:
- other: Another Dimension, or a value accepted by `as_dimension`.
+ other: Another Dimension.
Returns:
A Dimension whose value is `self` modulo `other`.
@@ -331,21 +279,6 @@ class Dimension(object):
else:
return Dimension(self._value % other.value)
- def __rmod__(self, other):
- """Returns `other` modulo `self`.
-
- Args:
- other: Another Dimension, or a value accepted by `as_dimension`.
-
- Returns:
- A Dimension whose value is `other` modulo `self`.
- """
- other = as_dimension(other)
- if self._value is None or other.value is None:
- return Dimension(None)
- else:
- return Dimension(other.value % self._value)
-
def __lt__(self, other):
"""Returns True if `self` is known to be less than `other`.
diff --git a/tensorflow/python/framework/tensor_shape_test.py b/tensorflow/python/framework/tensor_shape_test.py
index 4cf0e9fcd6..fffd86c7a6 100644
--- a/tensorflow/python/framework/tensor_shape_test.py
+++ b/tensorflow/python/framework/tensor_shape_test.py
@@ -34,17 +34,12 @@ class DimensionTest(test_util.TensorFlowTestCase):
self.assertEqual(tensor_shape.Dimension(15),
dim + tensor_shape.Dimension(3))
self.assertEqual(tensor_shape.Dimension(15), dim + 3)
- self.assertEqual(tensor_shape.Dimension(15), 3 + dim)
- self.assertEqual(tensor_shape.Dimension(9), dim - 3)
- self.assertEqual(tensor_shape.Dimension(1), 13 - dim)
self.assertEqual(tensor_shape.Dimension(24),
dim * tensor_shape.Dimension(2))
self.assertEqual(tensor_shape.Dimension(24), dim * 2)
- self.assertEqual(tensor_shape.Dimension(24), 2 * dim)
self.assertEqual(
tensor_shape.Dimension(6), dim // tensor_shape.Dimension(2))
self.assertEqual(tensor_shape.Dimension(6), dim // 2)
- self.assertEqual(tensor_shape.Dimension(0), 2 // dim)
self.assertEqual(tensor_shape.Dimension(12),
dim.merge_with(tensor_shape.Dimension(12)))
self.assertEqual(tensor_shape.Dimension(12), dim.merge_with(12))
@@ -181,14 +176,6 @@ class DimensionTest(test_util.TensorFlowTestCase):
self.assertEqual(str(tensor_shape.Dimension(7)), "7")
self.assertEqual(str(tensor_shape.Dimension(None)), "?")
- def testMod(self):
- four = tensor_shape.Dimension(4)
- nine = tensor_shape.Dimension(9)
- self.assertEqual(nine % four, 1)
- # test both __mod__ and __rmod__.
- self.assertEqual(nine % 4, 1)
- self.assertEqual(4 % nine, 4)
-
class ShapeTest(test_util.TensorFlowTestCase):