Replace all uses of tf.complex_abs with tf.abs and remove tf.complex_abs from the Python API.
Change: 142598006
This commit is contained in:
parent
cb4acf5e47
commit
edb095c19f
RELEASE.md
tensorflow
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -372,7 +372,7 @@ class UnaryOpTest(test.TestCase):
|
||||
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 @@ class ComplexMakeRealImagTest(test.TestCase):
|
||||
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)
|
||||
|
@ -77,10 +77,7 @@ class AbsOpTest(test.TestCase):
|
||||
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)
|
||||
|
@ -125,7 +125,6 @@ TensorFlow provides several operations that you can use to add complex number
|
||||
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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user