tests/testthat/test-storage.R

context("storage")

test_that("storage", {
  x <- torch_tensor(1)
  y <- x

  expect_equal(x$storage()$data_ptr(), y$storage()$data_ptr())

  k <- x$add_(1)
  expect_equal(x$storage()$data_ptr(), k$storage()$data_ptr())
})

Try the torch package in your browser

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

torch documentation built on June 7, 2023, 6:19 p.m.