mars-project / mars-project/mars
[BUG] TypeError: ufunc 'equal' did not contain a loop with signature matching types
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.7k
- Forks
- 325
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
```python
import numpy as np
import mars
import mars.tensor as mt
from mars.utils import new_random_id
mars.new_session()
s = np.array([new_random_id(20) for _ in range(10)])
target = s[5]
print(target == s) # It's OK.
s = mt.array([new_random_id(20) for _ in range(10)])
target = s[5]
r = target == s
r.execute() # Failed with TypeError.
```
Output
```python
Web service started at http://0.0.0.0:16758
[False False False False False True False False False False]
0%| | 0/100 [00:00, ) ->
100%|██████████| 100.0/100 [00:00<00:00, 202.76it/s]
Traceback (most recent call last):
File "/home/admin/mars/test.py", line 16, in
r.execute() # Failed with TypeError.
File "/home/admin/mars/mars/core/entity/tileables.py", line 462, in execute
result = self.data.execute(session=session, **kw)
File "/home/admin/mars/mars/core/entity/executable.py", line 144, in execute
return execute(self, session=session, **kw)
File "/home/admin/mars/mars/deploy/oscar/session.py", line 1890, in execute
return session.execute(
File "/home/admin/mars/mars/deploy/oscar/session.py", line 1684, in execute
execution_info: ExecutionInfo = fut.result(
File "/Users/po/.pyenv/versions/3.8.7/lib/python3.8/concurrent/futures/_base.py", line 439, in result
return self.__get_result()
File "/Users/po/.pyenv/versions/3.8.7/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
raise self._exception
File "/home/admin/mars/mars/deploy/oscar/session.py", line 1870, in _execute
await execution_info
File "/home/admin/mars/mars/deploy/oscar/session.py", line 105, in wait
return await self._aio_task
File "/home/admin/mars/mars/deploy/oscar/session.py", line 953, in _run_in_background
raise task_result.error.with_traceback(task_result.traceback)
File "/home/admin/mars/mars/services/task/supervisor/processor.py", line 365, in run
await self._process_stage_chunk_graph(*stage_args)
File "/home/admin/mars/mars/services/task/supervisor/processor.py", line 243, in _process_stage_chunk_graph
chunk_to_result = await self._executor.execute_subtask_graph(
File "/home/admin/mars/mars/services/task/execution/mars/executor.py", line 193, in execute_subtask_graph
return await stage_processor.run()
File "/home/admin/mars/mars/services/task/execution/mars/stage.py", line 240, in run
raise self.result.error.with_traceback(self.result.traceback)
File "/home/admin/mars/mars/services/subtask/worker/processor.py", line 189, in _execute_operand
return execute(ctx, op)
File "/home/admin/mars/mars/core/operand/core.py", line 496, in execute
raise TypeError(str(e)).with_traceback(sys.exc_info()[2]) from None
File "/home/admin/mars/mars/core/operand/core.py", line 491, in execute
result = executor(results, op)
File "/home/admin/mars/mars/tensor/arithmetic/core.py", line 165, in execute
ret = cls._execute_cpu(op, xp, lhs, rhs, **kw)
File "/home/admin/mars/mars/tensor/arithmetic/core.py", line 142, in _execute_cpu
return cls._get_func(xp)(lhs, rhs, **kw)
TypeError: ufunc 'equal' did not contain a loop with signature matching types (, ) ->
```
**To Reproduce**
To help us reproducing this bug, please provide information below:
1. Your Python version 3.8.7
2. The version of Mars you use Latest master 03f0f12ee682cbbfad758b5e26e8f9c8cc6a9986
3. Versions of crucial packages, such as numpy, scipy and pandas numpy==1.22.4, pandas==1.4.2
4. Full stack of the error.
5. Minimized code to reproduce the error.
**Expected behavior**
A clear and concise description of what you expected to happen.
**Additional context**
Add any other context about the problem here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the minimized example with Python 3.8.7, Mars commit 03f0f12ee682cbbfad758b5e26e8f9c8cc6a9986, and NumPy 1.22.4. Start in mars/tensor/arithmetic/core.py, especially _execute_cpu and the equality execution path. Done means comparing a Mars tensor of generated byte strings executes successfully and returns the expected boolean array, matching NumPy behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100