Skip to content

Conversation

@t-kalinowski
Copy link
Member

This PR adds a convert argument to all the builtin datasets like dataset_mnist().

If called like dataset_mnist(convert = FALSE), arrays are returned as Numpy arrays. e.g.:

str(dataset_mnist())
List of 2
 $ train:List of 2
  ..$ x: int [1:60000, 1:28, 1:28] 0 0 0 0 0 0 0 0 0 0 ...
  ..$ y: int [1:60000(1d)] 5 0 4 1 9 2 1 3 1 4 ...
 $ test :List of 2
  ..$ x: int [1:10000, 1:28, 1:28] 0 0 0 0 0 0 0 0 0 0 ...
  ..$ y: int [1:10000(1d)] 7 2 1 0 4 1 4 9 5 9 ...
str(dataset_mnist(convert = FALSE))
List of 2
 $ train:List of 2
  ..$ x: <numpy.ndarray shape(60000,28,28), dtype=uint8>
  ..$ y: <numpy.ndarray shape(60000), dtype=uint8>
 $ test :List of 2
  ..$ x: <numpy.ndarray shape(10000,28,28), dtype=uint8>
  ..$ y: <numpy.ndarray shape(10000), dtype=uint8>

@t-kalinowski t-kalinowski merged commit 07ad58f into main Oct 7, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants