nv-legate / cupynumeric

An Aspiring Drop-In Replacement for NumPy at Scale
https://docs.nvidia.com/cupynumeric
Apache License 2.0
623 stars 71 forks source link

[BUG] numpy.full has keyword arg "fill_value" #1144

Open suranap opened 3 months ago

suranap commented 3 months ago

https://github.com/nv-legate/cunumeric/blob/503affb8925ea576337f02da4e9dc52cca50d970/cunumeric/module.py#L384

change to fill_value. See doc.

suranap commented 3 months ago

Also, fill_value supports array_like, but cunumeric only supports scalar.

cnp is cunumeric

>>> np.full(shape=(5,2), fill_value=(4,5))
array([[4, 5],
       [4, 5],
       [4, 5],
       [4, 5],
       [4, 5]])
>>> cnp.full(shape=(5,2), fill_value=(4,5))
TypeError: only length-1 arrays can be converted to Python scalars

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/suranap/projects/legate/legate.core/legate/core/runtime.py", line 2154, in wrapper
    result = func(*args, **kwargs)
  File "/home/suranap/projects/legate/cunumeric/cunumeric/coverage.py", line 120, in wrapper
    return func(*args, **kwargs)
  File "/home/suranap/projects/legate/cunumeric/cunumeric/module.py", line 420, in full
    result._thunk.fill(val)
  File "/home/suranap/projects/legate/cunumeric/cunumeric/eager.py", line 536, in fill
    self.array.fill(value)
ValueError: setting an array element with a sequence.