8000 Dask indexing problem with cupy · Issue #11266 · dask/dask · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Dask indexing problem with cupy #11266
Open
@miguelcarcamov

Description

@miguelcarcamov

Hi, I want to index an array and then set those values to something.

So, this is the example that DOES NOT work.

Minimal Complete Verifiable Example:

import dask.array as da
import dask

dask.config.set({"array.backend": "cupy"})

data = da.random.random((20000,3))
condition = data[:,0] > 0.5
idx = da.flatnonzero(condition).compute()
data[idx] *= -1

Error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/miguel/.conda/envs/pyralysis-env/lib/python3.12/site-packages/dask/array/core.py", line 1926, in __setitem__
    dsk = setitem_array(out, self, key, value)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/miguel/.conda/envs/pyralysis-env/lib/python3.12/site-packages/dask/array/slicing.py", line 1843, in setitem_array
    raise ValueError(
ValueError: could not broadcast input array from shape(9961, 3) into shape (3,)

Anything else we need to know?:
The example above works with numpy as backend, works with only numpy and cupy.

Environment:

  • Dask version: dask==2024.6.0
  • Python version: Python 3.12.4
  • Operating System: Manjaro Linux x86_64
  • Install method (conda, pip, source): conda environment, package installed via pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0