tests/testthat/test-transforms-defaults.R

test_that("random_resised_crop", {

  img <- torch::torch_randn(3, 224, 224)
  o <- transform_random_resized_crop(img, size = c(32, 32))
  expect_tensor_shape(o, c(3, 32,32))

  im <- magick::image_read("torch.png")
  o <- transform_random_resized_crop(im, size = c(32, 32))
  expect_tensor_shape(transform_to_tensor(o), c(3, 32, 32))

})

Try the torchvision package in your browser

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

torchvision documentation built on June 22, 2024, 11:25 a.m.