-
Notifications
You must be signed in to change notification settings - Fork 74.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect behaviour of tf.nn.sigmoid
on complex inputs
#61800
Comments
@sachinprasadhs I was able to replicate the issue on colab using TF v2.13, tf-nightly. Please find the gist here for reference. Thank you! |
The same issue happens on input = tf.constant(-np.inf, dtype='complex128')
print(input) # tf.Tensor((-inf+0j), shape=(), dtype=complex128)
out = tf.nn.sigmoid(input)
print(out) # tf.Tensor((1+0j), shape=(), dtype=complex128) |
Hi @jshepherd01, The
OUTPUT
Please refer to the gist as well. Thank You |
This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. |
This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. |
Issue type
Bug
Have you reproduced the bug with TensorFlow Nightly?
Yes
Source
binary
TensorFlow version
tf v1.12.1-96406-gfa4d29bfef8 2.14.0-dev20230706
Custom code
Yes
OS platform and distribution
WSL Ubuntu 20.04.5 LTS
Mobile device
No response
Python version
No response
Bazel version
No response
GCC/compiler version
No response
CUDA/cuDNN version
No response
GPU model and memory
No response
Current behavior?
tf.nn.sigmoid
gives incorrect values for complex numbers with large, negative real parts (which should map to within a rounding error of 0). For example, whenx = -709-1j
(complex128
) I expecttf.nn.sigmoid(x) = 0
, but insteadtf.nn.sigmoid(x) = 1
.Standalone code to reproduce the issue
import tensorflow as tf x = tf.constant([-709-1j], dtype=tf.complex128) tf.nn.sigmoid(x) # <tf.Tensor: shape=(1,), dtype=complex128, numpy=array([1.+0.j])>
Relevant log output
No response
The text was updated successfully, but these errors were encountered: