2023-03-09 19:58:04 -05:00
|
|
|
function load_data(::Symbol; ::Int) :: Tuple
|
2023-12-24 12:52:21 +01:00
|
|
|
# <- @keyword.function
|
2024-04-14 07:23:46 -05:00
|
|
|
# ^ @function.call
|
2023-12-24 12:52:21 +01:00
|
|
|
# ^ @punctuation.bracket
|
|
|
|
|
# ^^ @punctuation.delimiter
|
|
|
|
|
# ^ @type.builtin
|
|
|
|
|
# ^ @punctuation.delimiter
|
|
|
|
|
# ^^ @punctuation.delimiter
|
|
|
|
|
# ^^^ @type.builtin
|
|
|
|
|
# ^ @punctuation.bracket
|
|
|
|
|
# ^^ @punctuation.delimiter
|
|
|
|
|
# ^ @type.builtin
|
2023-03-09 19:58:04 -05:00
|
|
|
dataset = CIFAR10(; Tx = Float32, split = split)
|
2023-12-24 12:52:21 +01:00
|
|
|
# ^^^^^^^ @variable
|
|
|
|
|
# ^ @operator
|
|
|
|
|
# ^ @function.call
|
|
|
|
|
# ^ @operator
|
|
|
|
|
# ^ @type.builtin
|
2023-03-09 19:58:04 -05:00
|
|
|
X = reshape(dataset.features[:, :, :, begin:n_obs], :, n_obs) # flattening the image pixels
|
2023-12-24 12:52:21 +01:00
|
|
|
# ^^^^^ @variable.builtin
|
2023-03-09 19:58:04 -05:00
|
|
|
y = categorical2onehot(dataset.targets[begin:n_obs], N_LABELS)
|
2023-12-24 12:52:21 +01:00
|
|
|
# ^^^^^ @variable.builtin
|
2023-03-09 19:58:04 -05:00
|
|
|
return X, y
|
2023-12-24 12:52:21 +01:00
|
|
|
# ^^^^^^ @keyword.return
|
2023-03-09 19:58:04 -05:00
|
|
|
end
|
2023-12-24 12:52:21 +01:00
|
|
|
# <- @keyword.function
|