`mnist` array structure

I have been using {keras} packages to run the deep learning tutorial in tensorflow.rstudio.com.

The problem is that the mnist$train$x is an array with dimension attribute c(60000, 28, 28). This is like having 60,000 28 by 28 matrices. But the way I can create an array like that in r, as far as I know, would be doing array( numeric(length = 28*28*60000), dim = c(28, 28, 60000) ), not array( numeric(length = 28*28*60000), dim = c(60000, 28, 28) ).

I just want to know how to create an array like this array(1:18, dim = c(3, 3, 2)) and change the dimension order to be c(2, 3, 3) like the array in keras::dataset_mnist()

Thanks, in advance.

PS: Sorry in case of any typo or grammar problem, English is not my native language

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.