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.

nan_to_num: TypeError: Wrong number of arguments

See original GitHub issue

Thank you for using and contributing to CuPy!

If your issue is a request for support in using CuPy, please post it on Stack Overflow or Google Groups (en / ja). Developer team members are monitoring questions on these channels.

If it is a bug report, please include the following information:

  • Conditions (you can just paste the output of python -c 'import cupy; cupy.show_config()')
    • CuPy version: cupy=9.4.0=py39h499daff_0 through Anaconda and channel conda-forge
    • OS/Platform: Arch Linux (Linux-5.14.9-arch2-1-x86_64-with-glibc2.33)
    • CUDA version: cudatoolkit=11.2.72=h2bc3f7f_0 through Anaconda and channel nvidia
    • cuDNN/NCCL version (if applicable):
      • cudnn=8.2.1.32=h86fa8c9_0 from channel conda-forge
      • nccl=2.10.3.1=hdc17891_0 from channel conda-forge
  • Code to reproduce
#! /usr/bin/env python3

# numpy
import numpy
np_a = numpy.array([float("NaN"), float("inf"), -float("inf")])
np_a = numpy.nan_to_num(np_a, True, 123., 456., 789.)
print(np_a)

# cupy
import cupy
cp_a = cupy.array([float("NaN"), float("inf"), -float("inf")])
cp_a = cupy.nan_to_num(cp_a, True, 123., 456., 789.)
print(cp_a)
  • Error messages, stack traces, or logs
Traceback (most recent call last):
  File "test.py", line 12, in <module>
    cp_a = cupy.nan_to_num(cp_a, True, 123., 456., 789.)
  File "cupy/_core/_kernel.pyx", line 1112, in cupy._core._kernel.ufunc.__call__
TypeError: Wrong number of arguments for 'cupy_nan_to_num'. It must be either 1 or 2 (with outputs), but given 5.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
piyuehcommented, Oct 11, 2021

Sorry for the late reply. I confirm the test code in the original bug report is working fine with the master branch. Thanks for the quick fix!

1reaction
kmaehashicommented, Oct 11, 2021

This will be fixed in the upcoming RC release this month. Thanks again for reporting, @piyueh!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python: reason for TypeError with wrong number of arguments
As discussed above, I am fine with raising an error with the wrong number of arguments (actually, I want that), the issue I...
Read more >
TypeError: wrong number of arguments when posting bytes ...
I have a bytearray containing image data from the TTL camera sample. I want to POST this as an octet stream to a...
Read more >
numpy.nan_to_num — NumPy v1.25.dev0 Manual
If no value is passed then negative infinity values will be replaced with a very small (or negative) number. New in version 1.17....
Read more >
[Python-Dev] Reasons behind misleading TypeError message ...
[Python-Dev] Reasons behind misleading TypeError message when passing the wrong number of arguments to a method.
Read more >
Wrong number of arguments: (0 . 0), 1 error on suspend ...
AFAIK in a terminal you genuinely are suspending the process. So Emacs can't do anything after that -- it was a foreground process, ......
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