Skip to content

Commit

Permalink
rcmdcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
sebffischer committed Feb 23, 2024
1 parent 64827ab commit 6c89f01
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
13 changes: 6 additions & 7 deletions R/lazy_tensor.R
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,13 @@ dd = function(x) {
#' head(as_lazy_tensor(iris_ds))
#'
#' iris_ds2 = dataset("iris",
#' initialize = function() {
#' self$iris = iris[, -5]
#' },
#' .getitem = function(i) {
#' list(x = torch_tensor(as.matrix(self$iris[i, ])))
#' }
#' initialize = function() self$iris = iris[, -5],
#' .getitem = function(i) list(x = torch_tensor(as.numeric(self$iris[i, ]))),
#' .length = function() nrow(self$iris)
#' )()
#' # if .getitem is implemented we cannot infer the shapes as they might vary,
#' # so we have to annotate them explicitly
#' as_lazy_tensor(iris_ds2, dataset_shapes = list(x = c(NA, 4L)))
#' as_lazy_tensor(iris_ds2, dataset_shapes = list(x = c(NA, 4L)))[1:5]
#'
#' # Convert a matrix
#' lt = as_lazy_tensor(matrix(rnorm(100), nrow = 20))
Expand All @@ -170,6 +167,8 @@ as_lazy_tensor.DataDescriptor = function(x, ids = NULL, ...) { # nolint
}

#' @rdname as_lazy_tensor
#' @param ids (`integer()`)\cr
#' Which ids to include in the lazy tensor.
#' @template param_dataset_shapes
#' @export
as_lazy_tensor.dataset = function(x, dataset_shapes = NULL, ids = NULL, ...) { # nolint
Expand Down
14 changes: 7 additions & 7 deletions man/as_lazy_tensor.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6c89f01

Please sign in to comment.