Skip to content

Commit 6ef38f6

Browse files
committed
minor fixes
1 parent fe16bf3 commit 6ef38f6

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

R/materialize.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ materialize.list = function(x, device = "cpu", rbind = FALSE, cache = "auto", ..
8585
materialize.data.frame = function(x, device = "cpu", rbind = FALSE, cache = "auto", ...) { # nolint
8686
if (nrow(x) == 0L) {
8787
if (rbind) {
88-
set_names(replicate(ncol(x), torch_empty(0L)), names(x))
88+
return(set_names(replicate(ncol(x), torch_empty(0L)), names(x)))
8989
} else {
90-
set_names(replicate(ncol(x), list()), names(x))
90+
return(set_names(replicate(ncol(x), list()), names(x)))
9191
}
9292
}
9393
materialize(as.list(x), device = device, rbind = rbind, cache = cache)

R/task_dataset.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ merge_compatible_lazy_tensor_graphs = function(lts) {
141141
pointer = if (pointer_name %nin% graph$output$name) {
142142
po_terminal = po("nop", id = uniqueify(pointer_name, graph$ids()))
143143
graph$add_pipeop(po_terminal, clone = FALSE)
144-
graph$add_pipeop(
144+
graph$add_edge(
145145
src_id = dd(lt)$pointer[1L],
146146
dst_id = po_terminal$id,
147147
src_channel = dd(lt)$pointer[2L],

R/utils.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#' The device. If not `NULL`, is returned as is.
77
#' @export
88
auto_device = function(device = NULL) {
9-
if (device == "auto") {
9+
if (!is.null(device) && device == "auto") {
1010
device = if (cuda_is_available()) "cuda" else "cpu"
1111
lg$debug("Auto-detected device '%s'.", device)
1212
}

tests/testthat/helper_autotest.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ expect_paramset = function(x, fns, exclude = character(0), exclude_defaults = ch
271271
}
272272

273273
expect_paramtest = function(paramtest) {
274-
expect_true(paramtest$ok, info = paramtest$info)
274+
info = if (length(paramtest$info)) paste(unlist(paramtest$info), collapse = "; ") else NULL
275+
expect_true(paramtest$ok, info = info)
275276
}
276277

277278

0 commit comments

Comments
 (0)