Skip to content

Commit 1109891

Browse files
authored
prevent vignette rendering when torch is not installed (#184)
1 parent ea2d182 commit 1109891

4 files changed

Lines changed: 16 additions & 9 deletions

File tree

R/mask-type.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,13 @@ entmax_15_function <- torch::autograd_function(
297297
#' @return The projection result P of the same shape as input, such that
298298
#' \eqn{\sum_{dim} P = 1 \forall dim} elementwise.
299299
#'
300-
#' @examples
300+
#' @examplesIf torch::torch_is_installed()
301+
#' \dontrun{
301302
#' input <- torch::torch_randn(10,5, requires_grad = TRUE)
302303
#' # create a top3 alpha=1.5 entmax on last input dimension
303304
#' nn_entmax <- entmax15(dim=-1L, k = 3)
304305
#' result <- nn_entmax(input)
306+
#' }
305307
#' @export
306308
entmax15 <- torch::nn_module(
307309
"entmax_15",

cran-comments.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@
44

55
* This is a new release.
66

7-
Note 1 : Package new submission after fixing the issues that led to archiving on 2025-04-01.
8-
Misspelled words in description are names and have been added to package `inst/WORDLIST`
9-
Note 2 : Example duration is inherent to fitting a model with the underlying torch framework.
7+
Note 1 : Example duration is inherent to fitting a model with the underlying torch framework.

man/entmax15.Rd

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/aum_loss.qmd

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@ format:
99
fig-width: 9
1010
fig-height: 6
1111
fig-cap-location: "top"
12-
knitr:
13-
opts_chunk:
14-
collapse: true
15-
comment: "#>"
16-
eval: true
1712
---
1813

14+
```{r, include = FALSE}
15+
knitr::opts_chunk$set(
16+
collapse = TRUE,
17+
comment = "#>",
18+
eval = torch::torch_is_installed()
19+
)
20+
```
21+
1922
```{r setup}
2023
library(tabnet)
2124
suppressPackageStartupMessages(library(tidymodels))

0 commit comments

Comments
 (0)