Retrieve one or more TorchLoss
es from mlr3torch_losses
.
Works like mlr3::lrn()
and mlr3::lrns()
.
Arguments
- .key
(
character(1)
)
Key of the object to retrieve.- ...
(any)
See description ofdictionary_sugar_get
.- .keys
(
character()
)
The keys of the losses.
See also
Other Torch Descriptor:
TorchCallback
,
TorchDescriptor
,
TorchLoss
,
TorchOptimizer
,
as_torch_callbacks()
,
as_torch_loss()
,
as_torch_optimizer()
,
mlr3torch_losses
,
mlr3torch_optimizers
,
t_clbk()
,
t_opt()
Examples
t_loss("mse", reduction = "mean")
#> <TorchLoss:mse> Mean Squared Error
#> * Generator: nn_mse_loss
#> * Parameters: reduction=mean
#> * Packages: torch,mlr3torch
#> * Task Types: regr
# get the dictionary
t_loss()
#> <DictionaryMlr3torchLosses> with 3 stored values
#> Keys: cross_entropy, l1, mse
t_losses(c("mse", "l1"))
#> $mse
#> <TorchLoss:mse> Mean Squared Error
#> * Generator: nn_mse_loss
#> * Parameters: list()
#> * Packages: torch,mlr3torch
#> * Task Types: regr
#>
#> $l1
#> <TorchLoss:l1> Absolute Error
#> * Generator: nn_l1_loss
#> * Parameters: list()
#> * Packages: torch,mlr3torch
#> * Task Types: regr
#>
# get the dictionary
t_losses()
#> <DictionaryMlr3torchLosses> with 3 stored values
#> Keys: cross_entropy, l1, mse