NetworkB.emadl 702 Bytes
Newer Older
Bernhard Rumpe's avatar
BR-sy  
Bernhard Rumpe committed
1
/* (c) https://github.com/MontiCore/monticore */
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
package InstanceTest;

component NetworkB<Z classes = 10> (Z convChannels){
    ports in Z(0:255)^{1,28,28} data,
         out Q(0:1)^{classes} predictions;

    implementation CNN {

        data ->
        Convolution(kernel=(5,5), channels=convChannels) ->
        Tanh() ->
        Pooling(pool_type="max", kernel=(2,2), stride=(2,2)) ->
        Convolution(kernel=(5,5), channels=convChannels) ->
        Tanh() ->
        Pooling(pool_type="max", kernel=(2,2), stride=(2,2)) ->
        FullyConnected(units=1000) ->
        Tanh() ->
        Dropout() ->
        FullyConnected(units=classes) ->
        Softmax() ->
22
        predictions;
23 24

    }
Bernhard Rumpe's avatar
BR-sy  
Bernhard Rumpe committed
25
}