Skip to contents

Retrieve one or more TorchLosses from mlr3torch_losses. Works like mlr3::lrn() and mlr3::lrns().

Usage

t_loss(.key, ...)

t_losses(.keys, ...)

Arguments

.key

(character(1))
Key of the object to retrieve.

...

(any)
See description of dictionary_sugar_get.

.keys

(character())
The keys of the losses.

Value

A TorchLoss

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