Skip to content

Commit 7193743

Browse files
authored
Merge pull request #1486 from rstudio/fix-image_load
`image_load()`: coerce `target_size` correctly
2 parents 7e0a756 + d75935f commit 7193743

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

R/image-utils.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ image_load <-
147147
function (path, color_mode = "rgb", target_size = NULL, interpolation = "nearest",
148148
keep_aspect_ratio = FALSE)
149149
{
150-
args <- capture_args()
150+
args <- capture_args(list(target_size = as_integer_tuple))
151151
do.call(keras$utils$load_img, args)
152152
}
153153

R/r-utils.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ as_integer_array <- function(x) {
271271
}
272272

273273
as_integer_tuple <- function(x, force_tuple = FALSE) {
274-
if (is.null(x))
274+
if (is.null(x) || is_py_object(x))
275275
x
276276
else if (is.list(x) || force_tuple)
277277
tuple(as.list(as.integer(x)))

0 commit comments

Comments
 (0)