Network.emadl 634 Bytes
Newer Older
nilsfreyer's avatar
nilsfreyer committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package cNNCalculator;

component Network<Z(2:oo) classes = 10>{
    ports in Z(0:255)^{1, 28, 28} image,
         out Q(0:1)^{classes} predictions;

    implementation CNN {
        image ->
        Convolution(kernel=(5,5), channels=20, padding="valid") ->
        Pooling(pool_type="max", kernel=(2,2), stride=(2,2), padding="valid") ->
        Convolution(kernel=(5,5), channels=50, padding="valid") ->
        Pooling(pool_type="max", kernel=(2,2), stride=(2,2), padding="valid") ->
        FullyConnected(units=500) ->
        Relu() ->
        FullyConnected(units=classes) ->
        Softmax() ->
        predictions

    }
}