Skip to content

Commit

Permalink
simplify array_reshape()
Browse files Browse the repository at this point in the history
  • Loading branch information
t-kalinowski committed Oct 22, 2024
1 parent b7832db commit 6c6aeab
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions R/array.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,7 @@ length.numpy.ndarray <- function(x) {
#' }
#' @export
array_reshape <- function(x, dim, order = c("C", "F")) {
np <- import("numpy", convert = FALSE)
order <- match.arg(order)
reshaped <- np$reshape(x, as.integer(dim), order = order)
if (!is_py_object(x))
reshaped <- py_to_r(reshaped)
reshaped
np <- import("numpy", convert = !is_py_object(x))
np$reshape(x, as.integer(dim), order = order)
}

0 comments on commit 6c6aeab

Please sign in to comment.