guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

05/05: gnu: Add r-torch.


From: guix-commits
Subject: 05/05: gnu: Add r-torch.
Date: Fri, 11 Feb 2022 09:50:51 -0500 (EST)

rekado pushed a commit to branch master
in repository guix.

commit 6baf2177df36bc33e79f1c71198dfe04d242efb2
Author: Ricardo Wurmus <rekado@elephly.net>
AuthorDate: Fri Feb 11 15:40:57 2022 +0100

    gnu: Add r-torch.
    
    * gnu/packages/cran.scm (r-torch): New variable.
---
 gnu/packages/cran.scm | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/gnu/packages/cran.scm b/gnu/packages/cran.scm
index 8d4cb1c7b2..73bbf6defe 100644
--- a/gnu/packages/cran.scm
+++ b/gnu/packages/cran.scm
@@ -55,6 +55,7 @@
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix gexp)
   #:use-module (guix git-download)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
@@ -22746,6 +22747,58 @@ and multivariate regression), and analysis of variance 
tolerance intervals.
 Visualizations are also available for most of these settings.")
     (license license:gpl2+)))
 
+;; Keep this in sync with the liblantern package.
+(define-public r-torch
+  (package
+    (name "r-torch")
+    (version "0.6.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (cran-uri "torch" version))
+       (sha256
+        (base32 "05vxb84qxna1rpzqhjw6gwyc569zyz7rfbdkahglvihqjjwabc4x"))))
+    (properties `((upstream-name . "torch")))
+    (build-system r-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'install 'link-libraries
+            (lambda* (#:key inputs #:allow-other-keys)
+              (let ((deps (string-append #$output "/site-library/torch/deps")))
+                (mkdir-p deps)
+                (symlink
+                 (search-input-file
+                  inputs "/lib/python3.9/site-packages/torch/lib/libtorch.so")
+                 (string-append deps "/libtorch.so"))
+                (symlink
+                 (search-input-file
+                  inputs "/lib/liblantern.so")
+                 (string-append deps "/liblantern.so"))))))))
+    (inputs
+     (list python-pytorch-for-r-torch
+           liblantern))
+    (propagated-inputs
+     (list r-bit64
+           r-callr
+           r-cli
+           r-coro
+           r-ellipsis
+           r-magrittr
+           r-r6
+           r-rcpp
+           r-rlang
+           r-withr))
+    (native-inputs (list r-knitr))
+    (home-page "https://torch.mlverse.org/docs";)
+    (synopsis "Tensors and neural networks with GPU acceleration")
+    (description
+     "This package provides functionality to define and train neural networks
+similar to PyTorch but written entirely in R using the libtorch library.  It
+also supports low-level tensor operations and GPU acceleration.")
+    (license license:expat)))
+
 (define-public r-additivitytests
   (package
     (name "r-additivitytests")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]