You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was reading the R6 chapter in Advanced R (https://adv-r.hadley.nz/r6.html#r6-classes), which recommends you assign the result of R6Class() into a variable with the same name as the class, because R6Class returns an R6 object that defines the class.
I've been digging into torch, and noticed that some classes follow this recommendation, like LRScheduler, but most classes follow the convention of assigning R6::R6Class(torch_CLASS_NAME) to a variable CLASS_NAME.
I was wondering what the reason for this discrepancy is?
The text was updated successfully, but these errors were encountered:
We append a torch_ prefix to most class names to avoid clashing s3 classes with other packages that might implement a LRScheduler object that is unrelated to torch.
We could also have named the obejct TorchLRScheduler and then use that as class name, but in general these objects are not exposed directly to users and we provide constructors like nn_module(), optim that correctly add the expected classes.
I was reading the R6 chapter in Advanced R (https://adv-r.hadley.nz/r6.html#r6-classes), which recommends you assign the result of
R6Class()
into a variable with the same name as the class, because R6Class returns an R6 object that defines the class.I've been digging into torch, and noticed that some classes follow this recommendation, like LRScheduler, but most classes follow the convention of assigning
R6::R6Class(torch_CLASS_NAME)
to a variableCLASS_NAME
.I was wondering what the reason for this discrepancy is?
The text was updated successfully, but these errors were encountered: