View source: R/DataDescriptor.R
as_data_descriptor | R Documentation |
Converts the input to a DataDescriptor
.
as_data_descriptor(x, dataset_shapes, ...)
x |
(any) |
dataset_shapes |
(named |
... |
(any) |
ds = dataset("example",
initialize = function() self$iris = iris[, -5],
.getitem = function(i) list(x = torch_tensor(as.numeric(self$iris[i, ]))),
.length = function() nrow(self$iris)
)()
as_data_descriptor(ds, list(x = c(NA, 4L)))
# if the dataset has a .getbatch method, the shapes are inferred
ds2 = dataset("example",
initialize = function() self$iris = iris[, -5],
.getbatch = function(i) list(x = torch_tensor(as.matrix(self$iris[i, ]))),
.length = function() nrow(self$iris)
)()
as_data_descriptor(ds2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.