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

[BUG] TypeError: ufunc 'equal' did not contain a loop with signature matching types #3163

Open
fyrestone opened this issue Jun 23, 2022 · 0 comments

Comments

@fyrestone
Copy link
Contributor

Describe the bug

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

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<?, ?it/s]Failed to run subtask tAMwz9tmam24QXaD6cjZg2Dp on band numa-0
Traceback (most recent call last):
  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 (<class 'numpy.dtype[bytes_]'>, <class 'numpy.dtype[bytes_]'>) -> <class 'numpy.dtype[bool_]'>
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 <module>
    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 (<class 'numpy.dtype[bytes_]'>, <class 'numpy.dtype[bytes_]'>) -> <class 'numpy.dtype[bool_]'>

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 03f0f12
  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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant