tensorflow / tensorflow

An Open Source Machine Learning Framework for Everyone
https://tensorflow.org
Apache License 2.0
185.48k stars 74.17k forks source link

tf.signal.rfft crashes when fft_length is [0] #74748

Closed maybeLee closed 2 days ago

maybeLee commented 2 weeks ago

Issue type

Bug

Have you reproduced the bug with TensorFlow Nightly?

Yes

Source

source

TensorFlow version

tf 2.17.0

Custom code

Yes

OS platform and distribution

No response

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?

When setting the fft_length to [0], the tf.signal.rfft will raises a program abort. If this parameter is invalid, raising an invalid argument error looks more clear to me instead of a program abort.

Standalone code to reproduce the issue

import tensorflow as tf
input = tf.constant([0.27], dtype='float32')
tf.signal.rfft(input, fft_length=[0])

### Relevant log output

```shell
Skipping registering GPU devices...
DUCC FFT r2c failed:
bazel-out/k8-opt/bin/external/ducc/_virtual_includes/fft/ducc/src/ducc0/fft/fftnd_impl.h: 139 (static void ducc0::detail_fft::util::sanity_check_cr(const fmav_info &, const fmav_info &, const shape_t &)):

Assertion failure
axis length mismatch

Aborted (core dumped)
maybeLee commented 2 weeks ago

I notice that this issue also occurs when using the tf.signal.irfft

import tensorflow as tf
input = tf.constant([0.27], dtype='complex64')
tf.signal.irfft(input, fft_length=[0])

error:

Skipping registering GPU devices...
DUCC FFT c2r failed:
bazel-out/k8-opt/bin/external/ducc/_virtual_includes/fft/ducc/src/ducc0/fft/fft1d_impl.h: 2948 (static Trpass<Tfs> ducc0::detail_fft::rfftpass<float>::make_pass(size_t, size_t, size_t, const Troots<Tfs> &, bool) [Tfs = float]):

Assertion failure
no zero-sized FFTs

Aborted (core dumped)
Venkat6871 commented 1 week ago

Hi @maybeLee , Apologize for the delay. I tried to run your code on Colab using TensorFlow version 2.17.0, nightly and encountered the same issue. As an alternative, I have provided a Gist for your reference. This issue is already being tracked, so it is a duplicate. Could you please check and let me know if i am wrong. Thank you!

github-actions[bot] commented 4 days ago

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.

maybeLee commented 2 days ago

Hi @Venkat6871 ,

Yes I think this issue is the duplicate of previous issue. I am closing this one and I will keep tracking the thread on previous issue. It is much appreciated if this issue can be fixed.

google-ml-butler[bot] commented 2 days ago

Are you satisfied with the resolution of your issue? Yes No