tests/testthat/test-map.R

test_that("tf_map", {
  skip_if_no_tensorflow()
  expect_equal(grab(tf_map(as_tensor(1:5), ~.x+1L)), array(2:6))
  expect_equal(grab(tf_map(as_tensor(1:5), ~ .+1L)), array(2:6))
  fn <- function(a) a+1L
  expect_equal(grab(tf_map(as_tensor(1:5),  fn )), array(2:6))
  expect_equal(grab(tf_map(as_tensor(1:5), "fn")), array(2:6))
})

Try the tfautograph package in your browser

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

tfautograph documentation built on Sept. 18, 2021, 1:07 a.m.