torchvision
torchvision copied to clipboard
transform_grayscale not implemented for torch_tensor error
Hi,
trying to load and transform png images using load_image function based on one of torchvision's vignettes
load_image <- function(path) {
x <- png::readPNG(path) %>%
transform_to_tensor() %>%
transform_grayscale(num_output_channels = 1) %>%
transform_resize(c(105, 105))
x <- x[newaxis,..]
}
but getting this error:
Error in `not_implemented_error()`:
! not implemented for torch_tensor
• not implemented for R7
> sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.4
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] forcats_0.5.1 stringr_1.4.0 dplyr_1.0.9 purrr_0.3.4 readr_2.1.2
[6] tidyr_1.2.0 tibble_3.1.7 ggplot2_3.3.6 tidyverse_1.3.1 torchvision_0.4.1.9000
[11] torch_0.7.2
loaded via a namespace (and not attached):
[1] httr_1.4.3 pkgload_1.2.4 bit64_4.0.5 vroom_1.5.7 jsonlite_1.8.0 modelr_0.1.8 brio_1.1.3
[8] assertthat_0.2.1 cellranger_1.1.0 remotes_2.4.2 sessioninfo_1.2.2 pillar_1.7.0 backports_1.4.1 glue_1.6.2
[15] rvest_1.0.2 colorspace_2.0-3 pkgconfig_2.0.3 devtools_2.4.3 broom_0.8.0 magick_2.7.3 haven_2.5.0
[22] scales_1.2.0 processx_3.5.3 tzdb_0.3.0 generics_0.1.2 usethis_2.1.5 ellipsis_0.3.2 cachem_1.0.6
[29] withr_2.5.0 cli_3.3.0 magrittr_2.0.3 crayon_1.5.1 readxl_1.4.0 memoise_2.0.1 ps_1.7.0
[36] fs_1.5.2 fansi_1.0.3 xml2_1.3.3 pkgbuild_1.3.1 tools_4.2.0 prettyunits_1.1.1 hms_1.1.1
[43] lifecycle_1.0.1 munsell_0.5.0 reprex_2.0.1 callr_3.7.0 compiler_4.2.0 rlang_1.0.2 grid_4.2.0
[50] rstudioapi_0.13 rappdirs_0.3.3 testthat_3.1.4 gtable_0.3.0 DBI_1.1.2 curl_4.3.2 R6_2.5.1
[57] lubridate_1.8.0 fastmap_1.1.0 bit_4.0.4 utf8_1.2.2 rprojroot_2.0.3 coro_1.0.2 desc_1.4.1
[64] stringi_1.7.6 parallel_4.2.0 Rcpp_1.0.8.3 png_0.1-7 vctrs_0.4.1 dbplyr_2.1.1 tidyselect_1.1.2