File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Usage
4
4
5
+ We currently support MNIST, FashionMNIST, and CIFAR10 training datasets.
6
+
7
+ Download or fetch datasets locally like:
8
+
5
9
``` elixir
6
10
{train_images, train_labels} = AxonDatasets .MNIST .download ()
7
11
12
+ # Unpack train_images like...
8
13
{images_binary, tensor_type, shape} = train_images
14
+ ```
9
15
10
- # Transform the data as it's fetched
16
+ You can also pass transform functions to ` download/1 ` :
17
+
18
+ ``` elixir
11
19
transform_images = fn {binary, type, shape} ->
12
20
binary
13
21
|> Nx .from_binary (type)
20
28
AxonDatasets .MNIST .download (transform_images: transform_images)
21
29
22
30
# Transform labels as well, e.g. get one-hot encoding
23
- transform_labels = fn {labels_binary, type, _shape } ->
31
+ transform_labels = fn {labels_binary, type, _ } ->
24
32
labels_binary
25
33
|> Nx .from_binary (type)
26
34
|> Nx .new_axis (- 1 )
@@ -45,7 +53,3 @@ def deps do
45
53
]
46
54
end
47
55
```
48
-
49
- Documentation can be generated with [ ExDoc] ( https://github.com/elixir-lang/ex_doc )
50
- and published on [ HexDocs] ( https://hexdocs.pm ) . Once published, the docs can
51
- be found at [ https://hexdocs.pm/axon_data ] ( https://hexdocs.pm/axon_data ) .
You can’t perform that action at this time.
0 commit comments