Base Class for Torch Descriptors
Abstract Base Class from which TorchLoss
, TorchOptimizer
, and TorchCallback
inherit. This class wraps a generator (R6Class Generator or the torch version of such a generator) and annotates it with metadata such as a ParamSet
, a label, an ID, packages, or a manual page.
The parameters are the construction arguments of the wrapped generator and the parameter $values
are passed to the generator when calling the public method $generate()
.
Defined by the constructor argument param_set
. All parameters are tagged with "train"
, but this is done automatically during initialize.
Other Torch Descriptor: TorchCallback
, TorchLoss
, TorchOptimizer
, as_torch_callbacks()
, as_torch_loss()
, as_torch_optimizer()
, mlr3torch_losses
, mlr3torch_optimizers
, t_clbk()
, t_loss()
, t_opt()
label
: (character(1)
)
Label for this object. Can be used in tables, plot and text output instead of the ID.
param_set
: (ParamSet
)
Set of hyperparameters.
packages
: (character(1)
)
Set of required packages. These packages are loaded, but not attached.
id
: (character(1)
)
Identifier of the object. Used in tables, plot and text output.
generator
: The wrapped generator that is described.
man
: (character(1)
)
String in the format `[pkg]::[topic]` pointing to a manual page for this object.
phash
: (character(1)
)
Hash (unique identifier) for this partial object, excluding some components which are varied systematically (e.g. the parameter values).
new()
Creates a new instance of this R6 class.
TorchDescriptor$new(
generator,
id = NULL,
param_set = NULL,
packages = NULL,
label = NULL,
man = NULL,
additional_args = NULL
)
generator
: The wrapped generator that is described.
id
: (character(1)
)
The id for of the new object.
param_set
: (ParamSet
)
The parameter set.
packages
: (character()
)
The R packages this object depends on.
label
: (character(1)
)
Label for the new instance.
man
: (character(1)
)
String in the format `[pkg]::[topic]` pointing to a manual page for this object. The referenced help package can be opened via method `$help()`.
additional_args
: (list()
)
Additional arguments if necessary. For learning rate schedulers, this is the torch::LRScheduler.
print()
Prints the object
TorchDescriptor$print(...)
...
: any
generate()
Calls the generator with the given parameter values.
TorchDescriptor$generate()
help()
Displays the help file of the wrapped object.
TorchDescriptor$help()
clone()
The objects of this class are cloneable with this method.
TorchDescriptor$clone(deep = FALSE)
deep
: Whether to make a deep clone.
Useful links