tests/testthat/test-activations.R

test_that("Activation functions only take real numbers or lists of real numbers", {
  expect_no_error(ReLU(c()))
  expect_no_error(ReLU(c(5, 5)))

  c() |>
    Sigmoid() |>
    expect_no_error()
  c(5, 5) |>
    Sigmoid() |>
    expect_no_error()

  c() |>
    Tanh() |>
    expect_no_error()
  c(5, 5) |>
    Tanh() |>
    expect_no_error()

  "Maarufa" |>
    Tanh() |> expect_error()
})

Try the nnR package in your browser

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

nnR documentation built on May 29, 2024, 2:02 a.m.