-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
[Bug]: Elementwise function cannot be applied or does not return the correct value to Python float
when ivy.set_array_mode(False)
#28839
Comments
Hi @34j. Thanks alot for opening the issue. Upon some close inspection, it turns out the actual bug is originating from printing the result of |
@YushaArif99 Thank you very much for your swift response and fix. I ran
However, the PyTorch one still persists. As you said, the Numpy one seems to be related to $ python -c "import ivy; ivy.set_backend('torch'); ivy.set_array_mode(True); print(ivy.log(1).shape)"
ivy.Shape()
$ python -c "import ivy; ivy.set_backend('torch'); ivy.set_array_mode(False); print(ivy.log(1).shape)"
venv/lib/python3.11/site-packages/ivy/func_wrapper.py:440: UserWarning: In the case of Compositional function, operators might cause inconsistent behavior when array_mode is set to False
warnings.warn(
torch.Size([0]) |
Hi @34j. Apologies for overlooking the 2nd example, totally slipped under my radar 😅 I have opened another PR with the These are the outputs I am getting: - import ivy; ivy.set_backend('numpy'); ivy.set_array_mode(False); print(ivy.log(1))
>>> 0.0
- import ivy; ivy.set_backend('numpy'); ivy.set_array_mode(True); print(ivy.log(1))
>>> ivy.array(0.)
- import ivy; ivy.set_backend('torch'); ivy.set_array_mode(False); print(ivy.log(1))
>>> tensor(0.)
- import ivy; ivy.set_backend('torch'); ivy.set_array_mode(True); print(ivy.log(1))
>>> ivy.array(0.) |
Bug Explanation
Calculating
log(1)
:python -c "import ivy; ivy.set_backend('numpy'); ivy.set_array_mode(False); print(ivy.log(1))" (long output) ivy.utils.exceptions.IvyBackendException: numpy: is_array: numpy: is_ivy_array: numpy: is_native_array: numpy: nested_argwhere: numpy: nested_argwhere: maximum recursion depth exceeded
These works:
python -c "import ivy; import numpy as np; ivy.set_backend('numpy'); ivy.set_array_mode(False); print(ivy.log(np.array(1)))" 0.0
python -c "import ivy; import torch; ivy.set_backend('torch'); ivy.set_array_mode(False); print(ivy.log(torch.tensor(1)))" tensor(0.)
Perhaps this kind of usage is not expected, but I would just like to report it anyway.
Steps to Reproduce Bug
Environment
Ubuntu 22.04
Ivy Version
1.0.0.0
Backend
Device
CPU
The text was updated successfully, but these errors were encountered: