tests/testthat/test-utils-testopt.R

test_that("can use custom functions with test_opt", {
    testthat::skip_on_cran()
    set.seed(1)
    expect_error(regexp = NA,{
        test_optim(
            optim = optim_adamw,
            test_fn = list(beale, domain_beale),
            opt_hparams = list(lr = 0.05),
            steps = 100,
            plot_each_step = TRUE
        )
    })
})

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.