-
Notifications
You must be signed in to change notification settings - Fork 52
Closed as not planned
Description
In data-apis/array-api-compat#345, a user wanted to json-serialize an Array API object. At the moment, this seems to require manually converting to a list of python int/float/bool objects.
For converting an array into a binary blob, we can export a DLPack capsule, but it does not seem to be serializable further:
In [28]: bytes(np.asarray([1, 2, 3]).__dlpack__())
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[28], line 1
----> 1 bytes(np.asarray([1, 2, 3]).__dlpack__())
TypeError: cannot convert 'PyCapsule' object to bytes
Serialization was previously discussed in #266; the difference here is scope: I'm only proposing to add a way to byte-export a dlpack capsule.
btjanaka
Metadata
Metadata
Assignees
Labels
No labels