Subject: [bug#72432] [PATCH 1/2] gnu: Add dlpack.

From: Nicolas Graves <[email-masked]>
Date: Sat, 3 Aug 2024 23:04:36 +0200

* gnu/packages/machine-learning.scm (dlpack): New variable.

Change-Id: I9223e5c3b8f8317f88954cfdaccdfa11a51b7167
---
 gnu/packages/machine-learning.scm | 34 +++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 4c5b713cbf..600e111594 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -133,6 +133,40 @@ (define-module (gnu packages machine-learning)
   #:use-module (gnu packages xorg)
   #:use-module (ice-9 match))
 
+(define-public dlpack
+  (package
+    (name "dlpack")
+    (version "0.8")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/dmlc/dlpack")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1jmfvdrx8dn9b0ksm04ixha0jnrk35ip796qg98kfz6g7niw5ir1"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list #:tests? #f)) ; no tests.
+    (home-page "https://github.com/dmlc/dlpack")
+    (synopsis "In Memory Tensor Structure")
+    (description "This package provides an open in-memory tensor structure for
+sharing tensors among frameworks.  DLPack enables
+@itemize
+@item Easier sharing of operators between deep learning frameworks.
+@item Easier wrapping of vendor level operator implementations, allowing
+collaboration when introducing new devices/ops.
+@item Quick swapping of backend implementations, like different version of
+BLAS
+@item For final users,this could bring more operators, and possibility of
+mixing usage between frameworks.
+@end itemize
+
+This package does not intend to implement Tensor and Ops, but instead use this
+as common bridge to reuse tensor and ops across frameworks.")
+    (license license:asl2.0)))
+
 (define-public fasttext
   (package
     (name "fasttext")
-- 
2.45.2