diff --git a/RELEASE.md b/RELEASE.md index 6674e437552923..a8bbc7064bfda4 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -57,6 +57,8 @@ * tf.image.decode_jpeg by default uses the faster DCT method, sacrificing a little fidelity for improved speed. One can revert to the old behavior by specifying the attribute dct_method='INTEGER_ACCURATE'. +* `tf.complex_abs` has been removed from the Python interface. `tf.abs` + supports complex tensors and should be used instead. # Release 0.12.0 diff --git a/tensorflow/core/ops/math_ops.cc b/tensorflow/core/ops/math_ops.cc index 04065849539e52..81cacffe96421c 100644 --- a/tensorflow/core/ops/math_ops.cc +++ b/tensorflow/core/ops/math_ops.cc @@ -175,13 +175,6 @@ Given a tensor `x` of complex numbers, this operation returns a tensor of type `float` or `double` that is the absolute value of each element in `x`. All elements in `x` must be complex numbers of the form \\(a + bj\\). The absolute value is computed as \\( \sqrt{a^2 + b^2}\\). - -For example: - -``` -# tensor 'x' is [[-2.25 + 4.75j], [-3.25 + 5.75j]] -tf.complex_abs(x) ==> [5.25594902, 6.60492229] -``` )doc"); // Declares cwise unary operations signature: 't -> 't diff --git a/tensorflow/python/kernel_tests/cwise_ops_test.py b/tensorflow/python/kernel_tests/cwise_ops_test.py index 79ec1ab62790ed..a828273314cd68 100644 --- a/tensorflow/python/kernel_tests/cwise_ops_test.py +++ b/tensorflow/python/kernel_tests/cwise_ops_test.py @@ -372,7 +372,7 @@ def testComplex64Basic(self): x = np.complex(1, 1) * np.arange(-3, 3).reshape(1, 3, 2).astype(np.complex64) y = x + 0.5 # no zeros - self._compareCpu(x, np.abs, math_ops.complex_abs) + self._compareCpu(x, np.abs, math_ops.abs) self._compareCpu(x, np.abs, _ABS) self._compareCpu(x, np.negative, math_ops.neg) self._compareCpu(x, np.negative, _NEG) @@ -1932,7 +1932,7 @@ def _compareBroadcastGradient(self, x): epsilon = 1e-3 with self.test_session(): for args in [(x_, 0.), (0., x_)]: - z = math_ops.reduce_sum(math_ops.complex_abs(math_ops.complex(*args))) + z = math_ops.reduce_sum(math_ops.abs(math_ops.complex(*args))) jacob_t, jacob_n = gradient_checker.compute_gradient( x_, list(x.shape), z, [1], x_init_value=x, delta=epsilon) self.assertAllClose(jacob_t, jacob_n, rtol=epsilon, atol=epsilon) diff --git a/tensorflow/python/ops/math_grad_test.py b/tensorflow/python/ops/math_grad_test.py index 6678ae4e26d1b9..8b0bc6b4f18cf1 100644 --- a/tensorflow/python/ops/math_grad_test.py +++ b/tensorflow/python/ops/math_grad_test.py @@ -77,10 +77,7 @@ def _testGrad(self, shape, dtype=None, max_error=None, bias=None, sigma=None): shape, bias=bias), dtype=dtype) with self.test_session(use_gpu=True): - if dtype in (dtypes.complex64, dtypes.complex128): - output = math_ops.complex_abs(value) - else: - output = math_ops.abs(value) + output = math_ops.abs(value) error = gradient_checker.compute_gradient_error( value, shape, output, output.get_shape().as_list()) self.assertLess(error, max_error) diff --git a/tensorflow/python/ops/math_ops.py b/tensorflow/python/ops/math_ops.py index 0f7727ae686cc2..20b9e438a1f265 100644 --- a/tensorflow/python/ops/math_ops.py +++ b/tensorflow/python/ops/math_ops.py @@ -125,7 +125,6 @@ functions to your graph. @@complex -@@complex_abs @@conj @@imag @@real @@ -439,31 +438,6 @@ def erf(x, name=None): return gen_math_ops.erf(x, name=name) -def complex_abs(x, name=None): - r"""Computes the complex absolute value of a tensor. - - Given a tensor `x` of complex numbers, this operation returns a tensor of type - `float32` or `float64` that is the absolute value of each element in `x`. All - elements in `x` must be complex numbers of the form \\(a + bj\\). The - absolute value is computed as \\( \sqrt{a^2 + b^2}\\). - - For example: - - ``` - # tensor 'x' is [[-2.25 + 4.75j], [-3.25 + 5.75j]] - tf.complex_abs(x) ==> [5.25594902, 6.60492229] - ``` - - Args: - x: A `Tensor` of type `complex64` or `complex128`. - name: A name for the operation (optional). - - Returns: - A `Tensor` of type `float32` or `float64`. - """ - return gen_math_ops._complex_abs(x, Tout=x.dtype.real_dtype, name=name) - - def scalar_mul(scalar, x): """Multiplies a scalar times a `Tensor` or `IndexedSlices` object.