on master help sign in
Update Readme
9989092Huw Campbell
README.md+15−9
@@ -35,24 +35,30 @@ type Shakespeare = RecurrentNetwork '[ R (LSTM 40 80), R (LSTM 80 40), F (FullyC
35 '[ 'D1 40, 'D1 80, 'D1 40, 'D1 40, 'D1 40 ]
35 '[ 'D1 40, 'D1 80, 'D1 40, 'D1 40, 'D1 40 ]
36```
36```
37
37
38+Design
39+------
38
40
39−The network can be thought of as a heterogeneous list of layers, where its type
41+Networks in Grenade can be thought of as a heterogeneous lists of layers, where
40−includes not only the layers of the network, but also the shapes of data that
42+their type includes not only the layers of the network, but also the shapes of
41−are passed between the layers.
43+data that are passed between the layers.
42
44
45+The definition of a network is surprisingly simple:
43```haskell
46```haskell
44data Network :: [*] -> [Shape] -> * where
47data Network :: [*] -> [Shape] -> * where
45− O :: Layer x i o => !x -> Network '[x] '[i, o]
48+ O :: (SingI i, SingI o, Layer x i o) => !x -> Network '[x] '[i, o]
46− (:~>) :: Layer x i h => !x -> !(Network xs (h ': hs)) -> Network (x ': xs) (i ': h ': hs)
49+ (:~>) :: (SingI i, SingI h, Layer x i h) => !x -> !(Network xs (h ': hs)) -> Network (x ': xs) (i ': h ': hs)
47```
50```
48
51
49The `Layer x i o` constraint ensures that the layer `x` can sensibly perform a
52The `Layer x i o` constraint ensures that the layer `x` can sensibly perform a
50transformation between the input and output shapes `i` and `o`.
53transformation between the input and output shapes `i` and `o`.
51
54
55+The lifted data kind `Shape` defines our 1, 2, and 3 dimension types, used to
56+declare what shape of data is passed between the layers.
57+
52−In the above example, the input layer can be seen to be a two dimensional (`D2`),
58+In the MNIST example above, the input layer can be seen to be a two dimensional
53−image with 28 by 28 pixels. When the first *Convolution* layer runs, it outputs
59+(`D2`), image with 28 by 28 pixels. When the first *Convolution* layer runs, it
54−a three dimensional (`D3`) 24x24x10 image. The last item in the list is one
60+outputs a three dimensional (`D3`) 24x24x10 image. The last item in the list is
55−dimensional (`D1`) with 10 values, representing the categories of the MNIST
61+one dimensional (`D1`) with 10 values, representing the categories of the MNIST
56data.
62data.
57
63
58Usage
64Usage