tests/testthat/test-data-structures.R

test_that("cast List wrapers", {
  model <- tf$keras$models$Sequential(list())
  model$denses <- list(tf$keras$layers$Dense(10L),
                       tf$keras$layers$Dense(10L))

  model$denses_dict <- list(abc = tf$keras$layers$Dense(10L),
                            def = tf$keras$layers$Dense(10L))

  expect_true(is.list(model$denses))
  expect_true(length(model$denses) == 2)

  expect_true(is.list(model$denses_dict))
  expect_true(length(model$denses_dict) == 2)
  expect_named(model$denses_dict, c("abc", "def"))
})

Try the tensorflow package in your browser

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

tensorflow documentation built on Sept. 28, 2023, 5:06 p.m.