STEllAR-GROUP / phylanx

An Asynchronous Distributed C++ Array Processing Toolkit
Boost Software License 1.0
75 stars 76 forks source link

Can't store to an array element #1236

Closed stevenrbrandt closed 4 years ago

stevenrbrandt commented 4 years ago

The following code

import numpy as np

@Phylanx
def foo():
    z = np.zeros((3,4))
    z[0][0] = 1

foo()

fails with the error

  File "k.py", line 9, in <module>
    foo()
  File "/home/jovyan/.local/lib/python3.6/site-packages/phylanx-0.0.1-py3.6-linux-x86_64.egg/phylanx/ast/transducer.py", line 168, in __call__
    result = self.backend.call(*mapped_args, **mapped_kwargs)
  File "/home/jovyan/.local/lib/python3.6/site-packages/phylanx-0.0.1-py3.6-linux-x86_64.egg/phylanx/ast/physl.py", line 578, in call
    self.wrapped_function.__name__, *args, **kwargs)
RuntimeError: k.py(7, 4): slice:: store function should only be called for the primitives that support it (e.g. variables): HPX(invalid_status)
hkaiser commented 4 years ago

@stevenrbrandt The Phylanx frontend understands (multi-) indexing an array using z[0, 0] = 1 only, at this time. I'll see what I can do to support z[0][0] = 1 as well.

stevenrbrandt commented 4 years ago

@hkaiser I had tried it both ways from Python. Maybe what's needed is a change to the Python parser.

hkaiser commented 4 years ago

@hkaiser I had tried it both ways from Python. Maybe what's needed is a change to the Python parser.

@stevenrbrandt please see #1240 for a possible fix

hkaiser commented 4 years ago

This is not fixed on master (#1240 is not merged yet)