helmholtz-analytics / heat

Distributed tensors and Machine Learning framework with GPU and MPI acceleration in Python
https://heat.readthedocs.io/
MIT License
209 stars 53 forks source link

setitem indexing with Lists #918

Open mtar opened 2 years ago

mtar commented 2 years ago

Description setitem raises an TypeError when a list is used for indexing along the split axis .

To Reproduce Steps to reproduce the behavior:

  1. Which module/class/function is affected? setitem
  2. What are the circumstances under which the bug appears? indexing along the split axis
  3. What is the exact error message / erroneous behavior?
    [1,1]<stderr>:  File "lib/python3.8/site-packages/heat/core/dndarray.py", line 1639, in __setitem__
    [1,1]<stderr>:    key[self.split] -= chunk_start
    [1,1]<stderr>:TypeError: unsupported operand type(s) for -=: 'list' and 'int'

Expected behavior accept lists

Illustrative

import heat as ht

a = ht.arange(3, split=0)
a[[0,1]] = a[[1,0]]
print(a)

Version Info master

ClaudiaComito commented 1 year ago

Addressed in #938


Reviewed within #1109

github-actions[bot] commented 11 months ago

Branch bugs/918-setitem_indexing_with_Lists created!

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 60 days with no activity.