| TorchIngressToken {mlr3torch} | R Documentation |
Torch Ingress Token
Description
This function creates an S3 class of class "TorchIngressToken", which is an internal data structure.
It contains the (meta-)information of how a batch is generated from a Task and fed into an entry point
of the neural network. It is stored as the ingress field in a ModelDescriptor.
Usage
TorchIngressToken(features, batchgetter, shape)
Arguments
features |
( |
batchgetter |
( |
shape |
( |
Value
TorchIngressToken object.
See Also
Other Graph Network:
ModelDescriptor(),
mlr_learners_torch_model,
mlr_pipeops_module,
mlr_pipeops_torch,
mlr_pipeops_torch_ingress,
mlr_pipeops_torch_ingress_categ,
mlr_pipeops_torch_ingress_ltnsr,
mlr_pipeops_torch_ingress_num,
model_descriptor_to_learner(),
model_descriptor_to_module(),
model_descriptor_union(),
nn_graph()
Examples
# Define a task for which we want to define an ingress token
task = tsk("iris")
# We create an ingress token for two feature Sepal.Length and Petal.Length:
# We have to specify the features, the batchgetter and the shape
features = c("Sepal.Length", "Petal.Length")
# As a batchgetter we use batchgetter_num
batch_dt = task$data(rows = 1:10, cols =features)
batch_dt
batch_tensor = batchgetter_num(batch_dt, "cpu")
batch_tensor
# The shape is unknown in the first dimension (batch dimension)
ingress_token = TorchIngressToken(
features = features,
batchgetter = batchgetter_num,
shape = c(NA, 2)
)
ingress_token