tests/testthat/test-events.R

test_that("Can't have untagged summaries", {

  temp <- tempfile()

  expect_error(with_logdir(temp, {
    log_event(1)
  }), regexp = "must have a tag")

  expect_error(with_logdir(temp, {
    log_event(summary_scalar(1))
  }), regexp = "must have a tag")

  expect_error(with_logdir(temp, {
    log_event(summary_scalar(1, tag = "hello"))
  }), regexp = NA)

  scalars <- collect_events(temp, type = "scalar")
  expect_equal(scalars$tag, "hello")

})

Try the tfevents package in your browser

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

tfevents documentation built on June 27, 2024, 5:10 p.m.