From c39e03bdb8bfae8a20d3f2759b5b640394d2dd91 Mon Sep 17 00:00:00 2001 From: Matthew Fidler Date: Sun, 24 Nov 2024 22:24:56 -0600 Subject: [PATCH] Fix examples --- NAMESPACE | 2 ++ R/gelu.R | 14 +++++++++----- R/softplus.R | 8 +------- man/GELU.Rd | 4 +++- man/dGELU.Rd | 8 ++++---- man/dsoftplus.Rd | 6 ------ man/reexports.Rd | 1 + man/softplus.Rd | 2 +- 8 files changed, 21 insertions(+), 24 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index bbe44c5e6..acec56761 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -344,6 +344,7 @@ export(.udfMd5Info) export(.useUtf) export(.vecDf) export(ELU) +export(GELU) export(PReLU) export(ReLU) export(RxODE) @@ -391,6 +392,7 @@ export(d3GELU) export(d4GELU) export(dELU) export(dELUa) +export(dGELU) export(dPReLU) export(dPReLUa) export(dPReLUa1) diff --git a/R/gelu.R b/R/gelu.R index 661c43dbf..e04a7e6f7 100644 --- a/R/gelu.R +++ b/R/gelu.R @@ -3,12 +3,15 @@ #' @param x numeric vector #' @return numeric vector #' @family Activation Functions +#' @export #' @examples #' #' GELU(c(-2, -1, 0, 1, 2)) #' #' # you can use rxode2 as well -#' r <- rxode2({r = GELU(x)}) +#' r <- rxode2({ +#' r = GELU(time) +#' }) #' et <- et(c(-2, -1, 0, 1, 2)) #' rxSolve(r, et) #' @@ -23,6 +26,7 @@ GELU <- function(x) { #' @param x numeric vector #' @return numeric vector #' @family Activation Functions +#' @export #' @examples #' dGELU(c(-2, -1, 0, 1, 2)) #' d2GELU(c(-2, -1, 0, 1, 2)) @@ -30,10 +34,10 @@ GELU <- function(x) { #' d4GELU(c(-2, -1, 0, 1, 2)) #' # you can use rxode2 as well #' r <- rxode2({ -#' r1 <- dGELU(x) -#' r2 <- d2GELU(x) -#' r3 <- d3GELU(x) -#' r4 <- d4GELU(x) +#' r1 <- dGELU(time) +#' r2 <- d2GELU(time) +#' r3 <- d3GELU(time) +#' r4 <- d4GELU(time) #' }) #' et <- et(c(-2, -1, 0, 1, 2)) #' rxSolve(r, et) diff --git a/R/softplus.R b/R/softplus.R index ed32d5386..0a069706c 100644 --- a/R/softplus.R +++ b/R/softplus.R @@ -12,7 +12,7 @@ #' # You can use rxode2 too: #' #' r <- rxode2({ -#' s <- softplus(x) +#' s <- softplus(time) #' }) #' #' e <- et(c(-1, 0, 1, 2)) @@ -34,17 +34,11 @@ softplus <- function(x) { #' @examples #' #' dsoftplus(c(-1, 0, 1, 2)) -#' d2softplus(c(-1, 0, 1, 2)) -#' d3softplus(c(-1, 0, 1, 2)) -#' d4softplus(c(-1, 0, 1, 2)) #' #' # You can use rxode2 too: #' #' r <- rxode2({ #' s1 <- dsoftplus(time) -#' s2 <- d2softplus(time) -#' s3 <- d3softplus(time) -#' s4 <- d4softplus(time) #' }) #' #' e <- et(c(-1, 0, 1, 2)) diff --git a/man/GELU.Rd b/man/GELU.Rd index 1f1f8fb2f..19b552b49 100644 --- a/man/GELU.Rd +++ b/man/GELU.Rd @@ -20,7 +20,9 @@ GELU activation function GELU(c(-2, -1, 0, 1, 2)) # you can use rxode2 as well -r <- rxode2({r = GELU(x)}) +r <- rxode2({ + r = GELU(time) +}) et <- et(c(-2, -1, 0, 1, 2)) rxSolve(r, et) diff --git a/man/dGELU.Rd b/man/dGELU.Rd index 0826f4974..e551f8be3 100644 --- a/man/dGELU.Rd +++ b/man/dGELU.Rd @@ -31,10 +31,10 @@ d3GELU(c(-2, -1, 0, 1, 2)) d4GELU(c(-2, -1, 0, 1, 2)) # you can use rxode2 as well r <- rxode2({ - r1 <- dGELU(x) - r2 <- d2GELU(x) - r3 <- d3GELU(x) - r4 <- d4GELU(x) + r1 <- dGELU(time) + r2 <- d2GELU(time) + r3 <- d3GELU(time) + r4 <- d4GELU(time) }) et <- et(c(-2, -1, 0, 1, 2)) rxSolve(r, et) diff --git a/man/dsoftplus.Rd b/man/dsoftplus.Rd index 460143388..019db5954 100644 --- a/man/dsoftplus.Rd +++ b/man/dsoftplus.Rd @@ -27,17 +27,11 @@ Default Softplus Activation Function \examples{ dsoftplus(c(-1, 0, 1, 2)) -d2softplus(c(-1, 0, 1, 2)) -d3softplus(c(-1, 0, 1, 2)) -d4softplus(c(-1, 0, 1, 2)) # You can use rxode2 too: r <- rxode2({ s1 <- dsoftplus(time) - s2 <- d2softplus(time) - s3 <- d3softplus(time) - s4 <- d4softplus(time) }) e <- et(c(-1, 0, 1, 2)) diff --git a/man/reexports.Rd b/man/reexports.Rd index 8cba3d62e..2857ff16d 100644 --- a/man/reexports.Rd +++ b/man/reexports.Rd @@ -38,3 +38,4 @@ below to see their documentation. \item{magrittr}{\code{\link[magrittr:pipe]{\%>\%}}} }} +\value{ Inherited from parent routine } diff --git a/man/softplus.Rd b/man/softplus.Rd index 1059978bc..631e058b0 100644 --- a/man/softplus.Rd +++ b/man/softplus.Rd @@ -22,7 +22,7 @@ softplus(c(-1, 0, 1, 2)) # You can use rxode2 too: r <- rxode2({ - s <- softplus(x) + s <- softplus(time) }) e <- et(c(-1, 0, 1, 2))