-
Notifications
You must be signed in to change notification settings - Fork 120
Closed
Labels
bugThe problem described is something that must be fixedThe problem described is something that must be fixed
Description
Version of Awkward Array
main
Description and code to reproduce
This code doesn't work
import awkward as ak
import numpy as np
from awkward._nplikes.virtual import VirtualNDArray
from awkward._nplikes.numpy import Numpy
offset_generator = lambda: np.array([0, 2, 4, 5, 6], dtype=np.int64)
data_generator = lambda: np.array([1, 2, 3, 4, 5, 6, 7, 8, 9], dtype=np.int64)
offsets = VirtualNDArray(Numpy.instance(), shape=(5,), dtype=np.int64, generator=offset_generator)
data = VirtualNDArray(Numpy.instance(), shape=(9,), dtype=np.int64, generator=data_generator)
buffers = {"node0-offsets": offsets, "node1-data": data}
form = ak.forms.ListOffsetForm("i64", ak.forms.NumpyForm("int64", form_key="node1"), form_key="node0")
array = ak.from_buffers(form, 4, buffers)but it should be equivalent this this, which does work
import awkward as ak
import numpy as np
from awkward._nplikes.virtual import VirtualNDArray
from awkward._nplikes.numpy import Numpy
offset_generator = lambda: np.array([0, 2, 4, 5, 6], dtype=np.int64)
data_generator = lambda: np.array([1, 2, 3, 4, 5, 6, 7, 8, 9], dtype=np.int64)
offsets = ak.index.Index(VirtualNDArray(Numpy.instance(), shape=(5,), dtype=np.int64, generator=offset_generator))
data = ak.contents.NumpyArray(VirtualNDArray(Numpy.instance(), shape=(9,), dtype=np.int64, generator=data_generator))
array = ak.Array(ak.contents.ListOffsetArray(offsets, data))Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugThe problem described is something that must be fixedThe problem described is something that must be fixed