1919#define DLPACK_MAJOR_VERSION 1
2020
2121/* ! \brief The current minor version of dlpack */
22- #define DLPACK_MINOR_VERSION 2
22+ #define DLPACK_MINOR_VERSION 3
2323
2424/* ! \brief DLPACK_DLL prefix for windows */
2525#ifdef _WIN32
@@ -375,7 +375,7 @@ typedef struct DLManagedTensorVersioned {
375375} DLManagedTensorVersioned;
376376
377377// ----------------------------------------------------------------------
378- // DLPack `__c_dlpack_exchange_api__ ` fast exchange protocol definitions
378+ // DLPack `__dlpack_c_exchange_api__ ` fast exchange protocol definitions
379379// ----------------------------------------------------------------------
380380/* !
381381 * \brief Request a producer library to create a new tensor.
@@ -391,7 +391,7 @@ typedef struct DLManagedTensorVersioned {
391391 * \param error_ctx Context for `SetError`.
392392 * \param SetError The function to set the error.
393393 * \return The owning DLManagedTensorVersioned* or NULL on failure.
394- * SetError is called exactly when NULL is returned (the implementor
394+ * SetError is called exactly when NULL is returned (the implementer
395395 * must ensure this).
396396 * \note - As a C function, must not thrown C++ exceptions.
397397 * - Error propagation via SetError to avoid any direct need
@@ -432,11 +432,11 @@ typedef int (*DLPackManagedTensorFromPyObjectNoSync)( //
432432 * \brief Exports a PyObject* Tensor/NDArray to a provided DLTensor.
433433 *
434434 * This function provides a faster interface for temporary, non-owning, exchange.
435- * The producer (implementor ) still owns the memory of data, strides, shape.
435+ * The producer (implementer ) still owns the memory of data, strides, shape.
436436 * The liveness of the DLTensor and the data it views is only guaranteed until
437437 * control is returned.
438438 *
439- * This function currently assumes that the producer (implementor ) can fill
439+ * This function currently assumes that the producer (implementer ) can fill
440440 * in the DLTensor shape and strides without the need for temporary allocations.
441441 *
442442 * This function does not perform any stream synchronization. The consumer should query
@@ -488,7 +488,7 @@ typedef int (*DLPackCurrentWorkStream)( //
488488 * \brief Imports a DLManagedTensorVersioned to a PyObject* Tensor/NDArray.
489489 *
490490 * Convert an owning DLManagedTensorVersioned* to the Python tensor of the
491- * producer (implementor ) library with the correct type.
491+ * producer (implementer ) library with the correct type.
492492 *
493493 * This function does not perform any stream synchronization.
494494 *
@@ -532,16 +532,17 @@ typedef struct DLPackExchangeAPIHeader {
532532 * \brief Framework-specific function pointers table for DLPack exchange.
533533 *
534534 * Additionally to `__dlpack__()` we define a C function table sharable by
535- * Python implementations via `__c_dlpack_exchange_api__`.
536- * This attribute must be set on the type as a Python integer compatible
537- * with `PyLong_FromVoidPtr`/`PyLong_AsVoidPtr`.
535+ *
536+ * Python implementations via `__dlpack_c_exchange_api__`.
537+ * This attribute must be set on the type as a Python PyCapsule
538+ * with name "dlpack_exchange_api".
538539 *
539540 * A consumer library may use a pattern such as:
540541 *
541542 * \code
542543 *
543- * PyObject *api_obj = type(tensor_obj).__c_dlpack_exchange_api__ ; // as C-code
544- * MyDLPackExchangeAPI *api = PyLong_AsVoidPtr (api_obj);
544+ * PyObject *api_obj = type(tensor_obj).__dlpack_c_exchange_api__ ; // as C-code
545+ * MyDLPackExchangeAPI *api = PyCapsule_GetPointer (api_obj, "dlpack_exchange_api" );
545546 * if (api == NULL && PyErr_Occurred()) { goto handle_error; }
546547 *
547548 * \endcode
0 commit comments