tests/testthat/test-tsne-serde.R

context("(de)serialization of TSNE models")

test_that("TSNE models can be serialized and unserialized correctly", {
  embedding <- cuda_ml_tsne(iris[1:4], method = "exact")
  model_state <- cuda_ml_serialize(embedding)

  expect_equal(
    embedding,
    callr::r(
      function(model_state) {
        library(cuda.ml)

        stopifnot(has_cuML())
        cuda_ml_unserialize(model_state)
      },
      args = list(model_state = model_state)
    )
  )
})

Try the cuda.ml package in your browser

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

cuda.ml documentation built on Jan. 8, 2022, 9:06 a.m.