Skip to content
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

AttributeError: np.cast was removed in NumPy 2.0 #2373

Open
sum1elf opened this issue Dec 19, 2024 · 1 comment
Open

AttributeError: np.cast was removed in NumPy 2.0 #2373

sum1elf opened this issue Dec 19, 2024 · 1 comment
Labels
bug An unexpected problem or unintended behavior

Comments

@sum1elf
Copy link

sum1elf commented Dec 19, 2024

Describe the bug
When using tf2onnx with TensorFlow 2.18 and NumPy 2.0.2, an AttributeError occurs due to the removal of np.cast in NumPy 2.0. The error message is as follows:
File "site-packages/tf2onnx/tfonnx.py", line 77, in rewrite_constant_fold "Cast": np.cast, AttributeError: np.cast was removed in the NumPy 2.0 release. Use np.asarray(arr, dtype=dtype) instead.

System information

  • OS Platform and Distribution: Ubuntu 22.04.5 LTS
  • TensorFlow Version: 2.18
  • tf2onnx Version: 2.16.1
  • Python version: 3.10.12

To Reproduce

  1. Install TensorFlow 2.18 and tf2onnx 1.16.1.
  2. Ensure NumPy above 2.0 is installed.
  3. Run a script that uses tf2onnx.
@LoreBadTime
Copy link

Hello, i did a dirty fix to resolve the issue(when I tested it I had no problems afterwards), just check my pull (sorry, i closed it when I deleted my forked repo, but you can still see the modifications)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants