diff --git a/DESCRIPTION b/DESCRIPTION index ec46dabc5..a205e5784 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: mirai Type: Package Title: Minimalist Async Evaluation Framework for R -Version: 0.12.0.9011 +Version: 0.12.1 Description: Lightweight parallel code execution and distributed computing. Designed for simplicity, a 'mirai' evaluates an R expression asynchronously, on local or network resources, resolving automatically upon completion. diff --git a/NEWS.md b/NEWS.md index 3204caf8f..a9cc39b8b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# mirai 0.12.0.9011 (development) +# mirai 0.12.1 * Dispatcher initial sync timeout widened to 10s to allow for launching large numbers of daemons. * Default for `ssh_config()` argument 'timeout' widened to 10 (seconds). diff --git a/R/mirai.R b/R/mirai.R index 2f65fe796..3fc9d1be3 100644 --- a/R/mirai.R +++ b/R/mirai.R @@ -29,15 +29,14 @@ #' @param ... (optional) named arguments (name = value pairs) specifying #' objects referenced in '.expr'. Used in addition to, and taking precedence #' over, any arguments specified via '.args'. -#' @param .args (optional) \strong{either} a list of objects to be passed by +#' @param .args (optional) \strong{either} a list of objects passed by #' \link{name} (found in the current scope), \strong{or else} a list of #' name = value pairs, as in '...'. #' @param .timeout [default NULL] for no timeout, or an integer value in #' milliseconds. A mirai will resolve to an 'errorValue' 5 (timed out) if #' evaluation exceeds this limit. #' @param .compute [default 'default'] character value for the compute profile -#' to use (each compute profile has its own set of daemons for connecting to -#' different resources). +#' to use (each compute profile has its own independent set of daemons). #' #' @return A 'mirai' object. #' diff --git a/R/next.R b/R/next.R index ddbfd9629..27b2523ab 100644 --- a/R/next.R +++ b/R/next.R @@ -1,4 +1,4 @@ -# Copyright (C) 2023 Hibiki AI Limited +# Copyright (C) 2023-2024 Hibiki AI Limited # # This file is part of mirai. # @@ -35,8 +35,8 @@ #' For \code{nextstream}: This function should be called for its return #' value when required. The function also has the side effect of #' automatically advancing the stream stored within the compute profile. -#' This ensures that next time the function is called the correct value will -#' be returned. +#' This ensures that the next recursive stream is returned when the function +#' is called again. #' #' @examples #' if (interactive()) { @@ -62,9 +62,9 @@ nextstream <- function(.compute = "default") next_stream(..[[.compute]]) #' \code{nextget} retrieves the specified item from the specified compute #' profile. #' -#' @param x character value of item to retrieve. One of 'pid' (dispatcher process -#' ID), 'urls' (URLs dispatcher is listening at) or 'tls' (the stored client -#' TLS configuration to be sent to daemons). +#' @param x character value of item to retrieve. One of 'pid' (dispatcher +#' process ID), 'urls' (URLs dispatcher is listening at) or 'tls' (the +#' stored client TLS configuration for use by daemons). #' #' @return For \code{nextget}: the requested item, or else NULL if not present. #' diff --git a/README.md b/README.md index 455d2f238..d79e52804 100644 --- a/README.md +++ b/README.md @@ -87,8 +87,8 @@ result. ``` r m$data -#> [1] 2.1008424 -1.1086334 -0.5883114 -0.1746657 -2.1993281 -0.4546843 -#> [7] -5.7252220 -1.6997800 -0.9020114 0.4759995 +#> [1] 6.34034300 -0.04935289 -16.62688852 -21.83976726 0.32279128 +#> [6] 3.09797711 -0.04578803 -0.06014354 -20.26223825 0.15772017 ``` Alternatively, explicitly call and wait for the result using @@ -96,8 +96,8 @@ Alternatively, explicitly call and wait for the result using ``` r call_mirai(m)$data -#> [1] 2.1008424 -1.1086334 -0.5883114 -0.1746657 -2.1993281 -0.4546843 -#> [7] -5.7252220 -1.6997800 -0.9020114 0.4759995 +#> [1] 6.34034300 -0.04935289 -16.62688852 -21.83976726 0.32279128 +#> [6] 3.09797711 -0.04578803 -0.06014354 -20.26223825 0.15772017 ``` ### Daemons diff --git a/man/daemons.Rd b/man/daemons.Rd index 0bd7c3f59..c8750f3e3 100644 --- a/man/daemons.Rd +++ b/man/daemons.Rd @@ -69,8 +69,7 @@ is encrypted with a password) For security, should be provided through a function that returns this value, rather than directly.} \item{.compute}{[default 'default'] character value for the compute profile -to use (each compute profile has its own set of daemons for connecting to -different resources).} +to use (each compute profile has its own independent set of daemons).} } \value{ Depending on the arguments supplied: diff --git a/man/everywhere.Rd b/man/everywhere.Rd index ad4ee8b4c..da65f4876 100644 --- a/man/everywhere.Rd +++ b/man/everywhere.Rd @@ -15,13 +15,12 @@ by \link{name}.} objects referenced in '.expr'. Used in addition to, and taking precedence over, any arguments specified via '.args'.} -\item{.args}{(optional) \strong{either} a list of objects to be passed by +\item{.args}{(optional) \strong{either} a list of objects passed by \link{name} (found in the current scope), \strong{or else} a list of name = value pairs, as in '...'.} \item{.compute}{[default 'default'] character value for the compute profile -to use (each compute profile has its own set of daemons for connecting to -different resources).} +to use (each compute profile has its own independent set of daemons).} } \value{ Invisible NULL. diff --git a/man/launch_local.Rd b/man/launch_local.Rd index 19bb9a42a..9b5ec0c12 100644 --- a/man/launch_local.Rd +++ b/man/launch_local.Rd @@ -39,8 +39,7 @@ comprising [i] the certificate authority certificate chain and [ii] the empty character ''.} \item{.compute}{[default 'default'] character value for the compute profile -to use (each compute profile has its own set of daemons for connecting to -different resources).} +to use (each compute profile has its own independent set of daemons).} \item{remote}{required only for launching remote daemons, a configuration generated by \code{\link{remote_config}} or \code{\link{ssh_config}}. An diff --git a/man/mirai.Rd b/man/mirai.Rd index 13e08152d..984712309 100644 --- a/man/mirai.Rd +++ b/man/mirai.Rd @@ -15,7 +15,7 @@ by \link{name}.} objects referenced in '.expr'. Used in addition to, and taking precedence over, any arguments specified via '.args'.} -\item{.args}{(optional) \strong{either} a list of objects to be passed by +\item{.args}{(optional) \strong{either} a list of objects passed by \link{name} (found in the current scope), \strong{or else} a list of name = value pairs, as in '...'.} @@ -24,8 +24,7 @@ milliseconds. A mirai will resolve to an 'errorValue' 5 (timed out) if evaluation exceeds this limit.} \item{.compute}{[default 'default'] character value for the compute profile -to use (each compute profile has its own set of daemons for connecting to -different resources).} +to use (each compute profile has its own independent set of daemons).} } \value{ A 'mirai' object. diff --git a/man/nextstream.Rd b/man/nextstream.Rd index b977a47dd..354170106 100644 --- a/man/nextstream.Rd +++ b/man/nextstream.Rd @@ -11,12 +11,11 @@ nextget(x, .compute = "default") } \arguments{ \item{.compute}{[default 'default'] character value for the compute profile -to use (each compute profile has its own set of daemons for connecting to -different resources).} +to use (each compute profile has its own independent set of daemons).} -\item{x}{character value of item to retrieve. One of 'pid' (dispatcher process -ID), 'urls' (URLs dispatcher is listening at) or 'tls' (the stored client -TLS configuration to be sent to daemons).} +\item{x}{character value of item to retrieve. One of 'pid' (dispatcher +process ID), 'urls' (URLs dispatcher is listening at) or 'tls' (the +stored client TLS configuration for use by daemons).} } \value{ For \code{nextstream}: a length 7 integer vector, as given by @@ -41,8 +40,8 @@ These functions are exported for use by packages extending For \code{nextstream}: This function should be called for its return value when required. The function also has the side effect of automatically advancing the stream stored within the compute profile. - This ensures that next time the function is called the correct value will - be returned. + This ensures that the next recursive stream is returned when the function + is called again. } \examples{ if (interactive()) { diff --git a/man/saisei.Rd b/man/saisei.Rd index d04b0990a..85e607891 100644 --- a/man/saisei.Rd +++ b/man/saisei.Rd @@ -13,8 +13,7 @@ saisei(i, force = FALSE, .compute = "default") when there is an existing active connection.} \item{.compute}{[default 'default'] character value for the compute profile -to use (each compute profile has its own set of daemons for connecting to -different resources).} +to use (each compute profile has its own independent set of daemons).} } \value{ The regenerated character URL upon success, or else NULL. diff --git a/vignettes/mirai.Rmd b/vignettes/mirai.Rmd index 33312a7aa..2b8f8a0a5 100644 --- a/vignettes/mirai.Rmd +++ b/vignettes/mirai.Rmd @@ -59,13 +59,13 @@ Upon completion, the 'mirai' resolves automatically to the evaluated result. ```r m$data |> str() -#> num [1:100000000] -0.852 0.957 1.6 16.365 -0.223 ... +#> num [1:100000000] 0.403 1.447 1.004 0.364 1.525 ... ``` Alternatively, explicitly call and wait for the result using `call_mirai()`. ```r call_mirai(m)$data |> str() -#> num [1:100000000] -0.852 0.957 1.6 16.365 -0.223 ... +#> num [1:100000000] 0.403 1.447 1.004 0.364 1.525 ... ``` For easy programmatic use of `mirai()`, '.expr' accepts a pre-constructed language object, and also a list of named arguments passed via '.args'. So, the following would be equivalent to the above: @@ -81,7 +81,7 @@ args <- list(m = runif(1), n = 1e8) m <- mirai(.expr = expr, .args = args) call_mirai(m)$data |> str() -#> num [1:100000000] 1.35 4.56 3.15 1.08 2.09 ... +#> num [1:100000000] 3.105 -0.931 0.943 3.262 0.151 ... ``` [« Back to ToC](#table-of-contents) @@ -160,8 +160,8 @@ for (i in 1:10) { #> iteration 3 successful #> iteration 4 successful #> iteration 5 successful -#> Error: random error #> iteration 6 successful +#> Error: random error #> iteration 7 successful #> iteration 8 successful #> iteration 9 successful @@ -197,12 +197,12 @@ status() #> #> $daemons #> i online instance assigned complete -#> abstract://e4b32b332af77c0c95ee3fd9 1 1 1 0 0 -#> abstract://fbebdbee9e5ec1dd20a1bebd 2 1 1 0 0 -#> abstract://3289fdb9dbcb5833cf8a351c 3 1 1 0 0 -#> abstract://5e5263fc9412beb099e9898a 4 1 1 0 0 -#> abstract://3357f9e81300066916058170 5 1 1 0 0 -#> abstract://6d7b135d8fa3fb4a3d27d246 6 1 1 0 0 +#> abstract://08b4b97238bde0689bc9514b 1 1 1 0 0 +#> abstract://63a8dca236eb13ad5303cdae 2 1 1 0 0 +#> abstract://64a11588f7f48743a45c7bcc 3 1 1 0 0 +#> abstract://f6e2b2f97f506bb617820921 4 1 1 0 0 +#> abstract://73bfd5425ff5b62788bad26f 5 1 1 0 0 +#> abstract://688211a2852bbecf432754e9 6 1 1 0 0 ``` The default `dispatcher = TRUE` creates a `dispatcher()` background process that connects to individual daemon processes on the local machine. This ensures that tasks are dispatched efficiently on a first-in first-out (FIFO) basis to daemons for processing. Tasks are queued at the dispatcher and sent to a daemon as soon as it can accept the task for immediate execution. @@ -231,7 +231,7 @@ status() #> [1] 6 #> #> $daemons -#> [1] "abstract://198a34d5cb2ec7c3213cce24" +#> [1] "abstract://8a07989c110b62dab5b65a4a" ``` This implementation sends tasks immediately, and ensures that tasks are evenly-distributed amongst daemons. This means that optimal scheduling is not guaranteed as the duration of tasks cannot be known *a priori*. As an example, tasks could be queued at a daemon behind a long-running task, whilst other daemons are idle having already completed their tasks. @@ -321,7 +321,7 @@ By specifying `dispatcher = FALSE`, remote daemons connect directly to the host ```r daemons(url = host_url(), dispatcher = FALSE) -#> [1] "tcp://hostname:36791" +#> [1] "tcp://hostname:36117" ``` Note that above, calling `host_url()` without a port value uses the default of '0'. This is a wildcard value that will automatically cause a free ephemeral port to be assigned. The actual assigned port is provided in the return value of the call, or it may be queried at any time via `status()`. @@ -335,7 +335,7 @@ status() #> [1] 0 #> #> $daemons -#> [1] "tcp://hostname:36791" +#> [1] "tcp://hostname:36117" ``` To reset all connections and revert to default behaviour: @@ -405,10 +405,10 @@ daemons(n = 2, url = host_url()) launch_remote(1:2) #> [1] -#> Rscript -e "mirai::daemon('tcp://hostname:35249',rs=c(10407,125460311,-1825782868,-462132035,1199418458,1304270355,2005083192))" +#> Rscript -e "mirai::daemon('tcp://hostname:43115',rs=c(10407,-512668947,-1821112118,19352515,924029480,-1421864439,1967253046))" #> #> [2] -#> Rscript -e "mirai::daemon('tcp://hostname:37295',rs=c(10407,-1309072200,704490761,557509925,-2139379427,1830875484,1912038244))" +#> Rscript -e "mirai::daemon('tcp://hostname:38413',rs=c(10407,1394391231,-727687268,-591259728,-971773911,72728696,-575275953))" daemons(0) #> [1] 0 @@ -436,37 +436,37 @@ The generated self-signed certificate is available via `launch_remote()`. This f ```r launch_remote(1) #> [1] -#> Rscript -e "mirai::daemon('wss://hostname:40119/1',tls=c('-----BEGIN CERTIFICATE----- +#> Rscript -e "mirai::daemon('wss://hostname:38377/1',tls=c('-----BEGIN CERTIFICATE----- #> MIIFNzCCAx+gAwIBAgIBATANBgkqhkiG9w0BAQsFADAzMREwDwYDVQQDDAhrdW1h #> bW90bzERMA8GA1UECgwITmFub25leHQxCzAJBgNVBAYTAkpQMB4XDTAxMDEwMTAw #> MDAwMFoXDTMwMTIzMTIzNTk1OVowMzERMA8GA1UEAwwIa3VtYW1vdG8xETAPBgNV #> BAoMCE5hbm9uZXh0MQswCQYDVQQGEwJKUDCCAiIwDQYJKoZIhvc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TirmgqV4McBhEPpbnOFyWBMIiqA== #> -----END CERTIFICATE----- -#> ',''),rs=c(10407,-568994202,-909779537,2103666724,-586663723,-1555213422,96228843))" +#> ',''),rs=c(10407,-1949455173,305385664,98036161,-1903821682,-341019721,-290458484))" ``` The printed value may be deployed directly on a remote machine. diff --git a/vignettes/parallel.Rmd b/vignettes/parallel.Rmd index 51d94095d..3a9e91016 100644 --- a/vignettes/parallel.Rmd +++ b/vignettes/parallel.Rmd @@ -51,7 +51,7 @@ status(cl) #> [1] 4 #> #> $daemons -#> [1] "abstract://3d4a4402496bfa98f98d2c2c" +#> [1] "abstract://dbfed51655e80d0b27a24cc6" stop_cluster(cl) ``` @@ -62,10 +62,10 @@ cl <- make_cluster(n = 2, url = host_url()) #> Shell commands for deployment on nodes: #> #> [1] -#> Rscript -e "mirai::daemon('tcp://hostname:46385',rs=c(10407,1330589964,-1191976291,1617653946,461158131,253482904,1523997881))" +#> Rscript -e "mirai::daemon('tcp://hostname:42471',rs=c(10407,1544508607,-732721164,-718427547,-1315073054,-812390917,-1575491328))" #> #> [2] -#> Rscript -e "mirai::daemon('tcp://hostname:46385',rs=c(10407,749396609,-578276799,2131323632,1725456233,-1056170017,453431426))" +#> Rscript -e "mirai::daemon('tcp://hostname:42471',rs=c(10407,1287587055,-2075729006,752482380,-1547133862,-1770470198,1209753632))" stop_cluster(cl) ``` diff --git a/vignettes/plumber.Rmd b/vignettes/plumber.Rmd index 062150166..1cb5df98d 100644 --- a/vignettes/plumber.Rmd +++ b/vignettes/plumber.Rmd @@ -67,14 +67,14 @@ res <- lapply(1:8, headers = c(msg = as.character(i)))) res <- lapply(res, call_aio) for (r in res) print(r$data) -#> [1] "{\"time\":[\"2024-01-11 18:00:27\"],\"msg\":[\"1\"],\"pid\":[11868]}" -#> [1] "{\"time\":[\"2024-01-11 18:00:27\"],\"msg\":[\"2\"],\"pid\":[11862]}" -#> [1] "{\"time\":[\"2024-01-11 18:00:27\"],\"msg\":[\"3\"],\"pid\":[11860]}" -#> [1] "{\"time\":[\"2024-01-11 18:00:27\"],\"msg\":[\"4\"],\"pid\":[11864]}" -#> [1] "{\"time\":[\"2024-01-11 18:00:28\"],\"msg\":[\"5\"],\"pid\":[11864]}" -#> [1] "{\"time\":[\"2024-01-11 18:00:28\"],\"msg\":[\"6\"],\"pid\":[11868]}" -#> [1] "{\"time\":[\"2024-01-11 18:00:28\"],\"msg\":[\"7\"],\"pid\":[11860]}" -#> [1] "{\"time\":[\"2024-01-11 18:00:28\"],\"msg\":[\"8\"],\"pid\":[11862]}" +#> [1] "{\"time\":[\"2024-02-01 16:43:51\"],\"msg\":[\"1\"],\"pid\":[262447]}" +#> [1] "{\"time\":[\"2024-02-01 16:43:51\"],\"msg\":[\"2\"],\"pid\":[262443]}" +#> [1] "{\"time\":[\"2024-02-01 16:43:51\"],\"msg\":[\"3\"],\"pid\":[262441]}" +#> [1] "{\"time\":[\"2024-02-01 16:43:52\"],\"msg\":[\"4\"],\"pid\":[262447]}" +#> [1] "{\"time\":[\"2024-02-01 16:43:51\"],\"msg\":[\"5\"],\"pid\":[262439]}" +#> [1] "{\"time\":[\"2024-02-01 16:43:52\"],\"msg\":[\"6\"],\"pid\":[262443]}" +#> [1] "{\"time\":[\"2024-02-01 16:43:52\"],\"msg\":[\"7\"],\"pid\":[262441]}" +#> [1] "{\"time\":[\"2024-02-01 16:43:52\"],\"msg\":[\"8\"],\"pid\":[262439]}" daemons(0) #> [1] 0 @@ -134,14 +134,14 @@ res <- lapply(1:8, data = sprintf('{"msg":"%d"}', i))) res <- lapply(res, call_aio) for (r in res) print(r$data) -#> [1] "{\"time\":[\"2024-01-11 18:00:31\"],\"msg\":[\"1\"],\"pid\":[12137]}" -#> [1] "{\"time\":[\"2024-01-11 18:00:31\"],\"msg\":[\"2\"],\"pid\":[12139]}" -#> [1] "{\"time\":[\"2024-01-11 18:00:32\"],\"msg\":[\"3\"],\"pid\":[12137]}" -#> [1] "{\"time\":[\"2024-01-11 18:00:31\"],\"msg\":[\"4\"],\"pid\":[12145]}" -#> [1] "{\"time\":[\"2024-01-11 18:00:32\"],\"msg\":[\"5\"],\"pid\":[12145]}" -#> [1] "{\"time\":[\"2024-01-11 18:00:31\"],\"msg\":[\"6\"],\"pid\":[12142]}" -#> [1] "{\"time\":[\"2024-01-11 18:00:32\"],\"msg\":[\"7\"],\"pid\":[12142]}" -#> [1] "{\"time\":[\"2024-01-11 18:00:32\"],\"msg\":[\"8\"],\"pid\":[12139]}" +#> [1] "{\"time\":[\"2024-02-01 16:43:56\"],\"msg\":[\"1\"],\"pid\":[262723]}" +#> [1] "{\"time\":[\"2024-02-01 16:43:56\"],\"msg\":[\"2\"],\"pid\":[262720]}" +#> [1] "{\"time\":[\"2024-02-01 16:43:56\"],\"msg\":[\"3\"],\"pid\":[262726]}" +#> [1] "{\"time\":[\"2024-02-01 16:43:56\"],\"msg\":[\"4\"],\"pid\":[262718]}" +#> [1] "{\"time\":[\"2024-02-01 16:43:57\"],\"msg\":[\"5\"],\"pid\":[262723]}" +#> [1] "{\"time\":[\"2024-02-01 16:43:57\"],\"msg\":[\"6\"],\"pid\":[262720]}" +#> [1] "{\"time\":[\"2024-02-01 16:43:57\"],\"msg\":[\"7\"],\"pid\":[262726]}" +#> [1] "{\"time\":[\"2024-02-01 16:43:57\"],\"msg\":[\"8\"],\"pid\":[262718]}" daemons(0) #> [1] 0 diff --git a/vignettes/torch.Rmd b/vignettes/torch.Rmd index 2b96367f6..389bfcd83 100644 --- a/vignettes/torch.Rmd +++ b/vignettes/torch.Rmd @@ -71,35 +71,35 @@ The returned model is an object containing many tensor elements. m$data$parameters$conv1.weight #> torch_tensor #> (1,1,.,.) = -#> 0.0383 0.1520 0.1109 0.0119 -0.1000 -#> 0.0859 -0.1157 0.0960 0.1383 0.0737 -#> 0.0155 0.1152 -0.1734 0.1927 -0.0850 -#> 0.1287 0.0048 -0.1009 0.1470 0.0258 -#> 0.1092 0.0588 0.0504 -0.0591 0.1244 +#> -0.0193 -0.0262 0.0308 0.0845 -0.0200 +#> -0.0404 -0.1880 0.0861 -0.0194 0.1317 +#> 0.1639 0.0296 -0.0472 -0.0103 -0.1201 +#> 0.1388 0.1742 0.1063 -0.1713 0.1978 +#> -0.0162 0.1412 0.0380 -0.0280 -0.1454 #> #> (2,1,.,.) = -#> -0.0541 0.0569 0.1552 -0.1217 0.0598 -#> 0.1246 -0.0290 -0.0351 0.0297 0.1209 -#> 0.0211 0.1039 -0.1791 -0.0348 -0.0183 -#> -0.1237 -0.1135 -0.1998 -0.1210 0.1453 -#> 0.1361 -0.1181 -0.0830 -0.1544 -0.0032 +#> 0.1296 0.1500 0.0238 -0.1578 -0.0618 +#> -0.1500 0.0225 0.0557 0.1778 -0.0811 +#> 0.0661 -0.1901 0.1322 -0.0638 -0.0589 +#> 0.1488 0.1738 -0.0089 0.1425 -0.1399 +#> 0.0925 -0.0132 0.0687 -0.1948 0.0033 #> #> (3,1,.,.) = -#> -0.1499 0.0196 0.1844 -0.0930 -0.1070 -#> 0.0126 -0.0639 -0.0543 -0.1243 0.1572 -#> -0.1456 0.1143 0.1234 0.0045 0.0432 -#> -0.0010 0.0277 -0.1796 0.1019 -0.1668 -#> -0.1633 -0.0722 -0.1908 -0.0810 -0.1464 +#> -0.0904 -0.1187 0.1255 -0.0646 0.1928 +#> 0.1217 -0.1250 0.0129 -0.0716 -0.0458 +#> 0.1168 -0.1885 0.1726 -0.1144 0.1238 +#> -0.0081 0.0355 -0.1547 0.1598 0.0794 +#> 0.1676 0.1681 0.0128 0.0941 0.1344 #> #> (4,1,.,.) = -#> 0.0554 -0.0543 0.1105 0.1958 -0.1307 -#> 0.0055 -0.0285 0.0316 -0.0255 -0.1464 -#> -0.1972 0.1867 0.1503 -0.0229 -0.1025 -#> 0.1923 0.1258 -0.1582 0.1873 0.1510 -#> -0.1501 0.0139 -0.0719 -0.1983 -0.0373 +#> 0.0562 0.1450 -0.1598 0.1984 0.1108 +#> -0.1500 0.0927 -0.0415 -0.1034 0.1692 +#> 0.0995 -0.0878 -0.1666 -0.0376 0.1874 +#> 0.0130 0.0755 -0.0761 0.0096 0.1477 +#> -0.0088 -0.1726 -0.0486 -0.0006 0.1492 #> #> (5,1,.,.) = -#> -0.0986 -0.1050 -0.0045 0.1681 -0.1684 +#> 0.1770 0.0137 -0.0971 0.1783 0.1272 #> ... [the output was truncated (use n=-1 to disable)] #> [ CPUFloatType{20,1,5,5} ][ requires_grad = TRUE ] ```