R/utils-state.R

Defines functions `state<-` state

Documented in state

#' @title Imported function
#' @author Daniel Falbel, \email{dfalbel@@gmail.com}
#' @keywords internal
#' @description Code lifted from a internal function of madgrad package.
#'   Get 'state' attribute of an object.
state <- function(self) {
    attr(self, "state")
}

#' @title Imported function
#' @author Daniel Falbel, \email{dfalbel@@gmail.com}
#' @keywords internal
#' @description Code lifted from a internal function of madgrad package.
#'   Set 'state' attribute of an object.
`state<-` <- function(self, value) {
    attr(self, "state") <- value
    self
}

Try the torchopt package in your browser

Any scripts or data that you put into this service are public.

torchopt documentation built on June 7, 2023, 6:10 p.m.