question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`cupyx.scipy.fft` is not compatible with `scipy.fft`

See original GitHub issue

In SciPy, scipy.fft is accessible after importing scipy.

$ python -c 'import scipy; print(scipy.fft)'
<module 'scipy.fft' from '/home/niboshi/.pyenv/versions/3.8.0/lib/python3.8/site-packages/scipy/fft/__init__.py'>

cupyx.scipy.fft is not accessible after importing cupyx.scipy.

$ python -c 'import cupyx.scipy; print(cupyx.scipy.fft)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'cupyx.scipy' has no attribute 'fft'

(What follows is the initial version of this post, where I used an old version of SciPy (1.3.3) and it doesn’t apply to the newest one).

In SciPy, scipy.fft is accessible after importing scipy and is a function.

$ python -c 'import scipy; print(scipy.fft)'
<function fft at 0x7fab290c95e0>

cupyx.scipy.fft is not accessible after importing cupyx.scipy.

$ python -c 'import cupyx.scipy; print(cupyx.scipy.fft)'
Traceback (most recent call last):
 File "<string>", line 1, in <module>
AttributeError: module 'cupyx.scipy' has no attribute 'fft'

Further, it’s not a function. You have to spell out as cupyx.scipy.fft.fft.

$ python -c 'import cupyx.scipy.fft; print(cupyx.scipy.fft)'
<module 'cupyx.scipy.fft' from '/data2/work/w/repos/cupy/cupyx/scipy/fft/__init__.py'>

$ python -c 'import cupyx.scipy.fft; print(cupyx.scipy.fft.fft)'
<function fft at 0x7f4787ea91f0>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
grlee77commented, Dec 20, 2019

This function scipy.fft is just numpy.fft.fft. There are a number of other NumPy functions that get imported into the root SciPy namespace as well, but all of them have recently been deprecated: https://github.com/scipy/scipy/pull/10290.

We would like to remove all of them as it is odd to provide functions from a separate library in the public API. Most of them may not be removed for some time, but the current plan is to remove scipy.fft from 1.5 so we don’t have this weird hack where there is both a function and module with the same name!

0reactions
niboshicommented, Dec 23, 2019

https://github.com/scipy/scipy/issues/11264#issuecomment-568426924

Closing as it’s confirmed we don’t have to follow SciPy’s behavior.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Discrete Fourier transforms (cupyx.scipy.fft) — CuPy 11.4.0 ...
fft : when it is set to True , the input array x can (not will) be overwritten arbitrarily. For this reason, when...
Read more >
CuPy Documentation - Read the Docs
CuPy covers the full Fast Fourier Transform (FFT) functionalities provided in NumPy (cupy.fft) and a subset in. SciPy (cupyx.scipy.fft).
Read more >
scipy.fft.fft — SciPy v1.9.3 Manual
Compute the 1-D discrete Fourier Transform. This function computes the 1-D n-point discrete Fourier Transform (DFT) with the efficient Fast Fourier Transform ( ......
Read more >
CuPy v11 is now available - Medium
Previously, CuPy provided binary packages for all supported CUDA releases; cupy-cuda112 for CUDA ... cupyx.scipy.fft.ifhtcupyx.scipy.spatial.distance_matrix
Read more >
Python Examples of scipy.fft - ProgramCreek.com
The following are 29 code examples of scipy.fft(). ... the contents of ``x`` can be destroyed. plan (None): This argument is currently not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found