def __init__(self, rng):

            Network.__init__(self,
                             n_hidden_layer=n_hidden_layer,
                             BN_LSTM=BN_LSTM)

            print("LSTM layer:")
            self.layer.append(
                LSTM(rng=rng,
                     n_inputs=n_inputs,
                     n_units=n_units,
                     initial_gamma=initial_gamma,
                     initial_beta=initial_beta,
                     length=length - 1,
                     batch_size=batch_size,
                     BN=BN_LSTM,
                     BN_epsilon=BN_epsilon,
                     dropout=dropout_input,
                     binary_training=binary_training,
                     ternary_training=ternary_training,
                     stochastic_training=stochastic_training))

            print("Softmax layer:")
            self.layer.append(
                linear_layer(rng=rng,
                             n_inputs=n_units,
                             n_units=n_classes,
                             dropout=dropout_input))
Esempio n. 2
0
        def __init__(self, rng):

            Network.__init__(self, n_hidden_layer=n_hidden_layer, BN=BN)

            print "    Fully connected layer 1:"
            self.layer.append(
                ReLU_layer(rng=rng,
                           n_inputs=n_inputs,
                           n_units=n_units,
                           BN=BN,
                           BN_epsilon=BN_epsilon,
                           dropout=dropout_input,
                           binary_training=binary_training,
                           stochastic_training=stochastic_training,
                           binary_test=binary_test,
                           stochastic_test=stochastic_test))

            for k in range(n_hidden_layer - 1):

                print "    Fully connected layer " + str(k) + ":"
                self.layer.append(
                    ReLU_layer(rng=rng,
                               n_inputs=n_units,
                               n_units=n_units,
                               BN=BN,
                               BN_epsilon=BN_epsilon,
                               dropout=dropout_hidden,
                               binary_training=binary_training,
                               stochastic_training=stochastic_training,
                               binary_test=binary_test,
                               stochastic_test=stochastic_test))

            print "    L2 SVM layer:"
            self.layer.append(
                linear_layer(rng=rng,
                             n_inputs=n_units,
                             n_units=n_classes,
                             BN=BN,
                             BN_epsilon=BN_epsilon,
                             dropout=dropout_hidden,
                             binary_training=binary_training,
                             stochastic_training=stochastic_training,
                             binary_test=binary_test,
                             stochastic_test=stochastic_test))
Esempio n. 3
0
 def __init__(self, rng):
     
     Network.__init__(self, n_hidden_layer = n_hidden_layer, BN = BN)
     
     print "    Fully connected layer 1:"
     self.layer.append(ReLU_layer(rng = rng, n_inputs = n_inputs, n_units = n_units,
         BN = BN, BN_epsilon=BN_epsilon, dropout=dropout_input,
         binary_training=binary_training, stochastic_training=stochastic_training,
         binary_test=binary_test, stochastic_test=stochastic_test))
     
     for k in range(n_hidden_layer-1):
         
         print "    Fully connected layer "+ str(k) +":"
         self.layer.append(ReLU_layer(rng = rng, n_inputs = n_units, n_units = n_units,
             BN = BN, BN_epsilon=BN_epsilon, dropout=dropout_hidden, 
             binary_training=binary_training, stochastic_training=stochastic_training,
             binary_test=binary_test, stochastic_test=stochastic_test))
         
     print "    L2 SVM layer:"
     self.layer.append(linear_layer(rng = rng, n_inputs = n_units, n_units = n_classes,
         BN = BN, BN_epsilon=BN_epsilon, dropout=dropout_hidden, 
         binary_training=binary_training, stochastic_training=stochastic_training,
         binary_test=binary_test, stochastic_test=stochastic_test))
Esempio n. 4
0
        def __init__(self, rng):

            Network.__init__(self, n_hidden_layer=8, BN=BN)

            print "    C3 layer:"

            self.layer.append(
                ReLU_conv_layer(rng,
                                filter_shape=(128, 3, 3, 3),
                                pool_shape=(1, 1),
                                pool_stride=(1, 1),
                                BN=BN,
                                BN_epsilon=BN_epsilon,
                                binary_training=binary_training,
                                stochastic_training=stochastic_training,
                                binary_test=binary_test,
                                stochastic_test=stochastic_test))

            print "    C3 P2 layers:"

            self.layer.append(
                ReLU_conv_layer(rng,
                                filter_shape=(128, 128, 3, 3),
                                pool_shape=(2, 2),
                                pool_stride=(2, 2),
                                BN=BN,
                                BN_epsilon=BN_epsilon,
                                binary_training=binary_training,
                                stochastic_training=stochastic_training,
                                binary_test=binary_test,
                                stochastic_test=stochastic_test))

            print "    C2 layer:"

            self.layer.append(
                ReLU_conv_layer(rng,
                                filter_shape=(256, 128, 2, 2),
                                pool_shape=(1, 1),
                                pool_stride=(1, 1),
                                BN=BN,
                                BN_epsilon=BN_epsilon,
                                binary_training=binary_training,
                                stochastic_training=stochastic_training,
                                binary_test=binary_test,
                                stochastic_test=stochastic_test))

            print "    C2 P2 layers:"

            self.layer.append(
                ReLU_conv_layer(rng,
                                filter_shape=(256, 256, 2, 2),
                                pool_shape=(2, 2),
                                pool_stride=(2, 2),
                                BN=BN,
                                BN_epsilon=BN_epsilon,
                                binary_training=binary_training,
                                stochastic_training=stochastic_training,
                                binary_test=binary_test,
                                stochastic_test=stochastic_test))

            print "    C2 layer:"

            self.layer.append(
                ReLU_conv_layer(rng,
                                filter_shape=(512, 256, 2, 2),
                                pool_shape=(1, 1),
                                pool_stride=(1, 1),
                                BN=BN,
                                BN_epsilon=BN_epsilon,
                                binary_training=binary_training,
                                stochastic_training=stochastic_training,
                                binary_test=binary_test,
                                stochastic_test=stochastic_test))

            print "    C2 P2 layers:"

            self.layer.append(
                ReLU_conv_layer(rng,
                                filter_shape=(512, 512, 2, 2),
                                pool_shape=(2, 2),
                                pool_stride=(2, 2),
                                BN=BN,
                                BN_epsilon=BN_epsilon,
                                binary_training=binary_training,
                                stochastic_training=stochastic_training,
                                binary_test=binary_test,
                                stochastic_test=stochastic_test))

            print "    C2 layer:"

            self.layer.append(
                ReLU_conv_layer(rng,
                                filter_shape=(1024, 512, 2, 2),
                                pool_shape=(1, 1),
                                pool_stride=(1, 1),
                                BN=BN,
                                BN_epsilon=BN_epsilon,
                                binary_training=binary_training,
                                stochastic_training=stochastic_training,
                                binary_test=binary_test,
                                stochastic_test=stochastic_test))

            print "    FC layer:"

            self.layer.append(
                ReLU_layer(rng=rng,
                           n_inputs=1024,
                           n_units=1024,
                           BN=BN,
                           BN_epsilon=BN_epsilon,
                           dropout=dropout_hidden,
                           binary_training=binary_training,
                           stochastic_training=stochastic_training,
                           binary_test=binary_test,
                           stochastic_test=stochastic_test))

            print "    L2 SVM layer:"

            self.layer.append(
                linear_layer(rng=rng,
                             n_inputs=1024,
                             n_units=10,
                             BN=BN,
                             BN_epsilon=BN_epsilon,
                             dropout=dropout_hidden,
                             binary_training=binary_training,
                             stochastic_training=stochastic_training,
                             binary_test=binary_test,
                             stochastic_test=stochastic_test))
Esempio n. 5
0
        def __init__(self, rng):

            Network.__init__(self, n_hidden_layer = 8, BN = BN)
            
            print "    C3 layer:"
                
            self.layer.append(ReLU_conv_layer(
                rng,
                filter_shape=(128, 3, 3, 3),
                pool_shape=(1,1),
                pool_stride=(1,1),
                BN = BN,                     
                BN_epsilon=BN_epsilon,
                binary_training=binary_training, 
                stochastic_training=stochastic_training,
                binary_test=binary_test, 
                stochastic_test=stochastic_test
            ))
            
            print "    C3 P2 layers:"
                
            self.layer.append(ReLU_conv_layer(
                rng,
                filter_shape=(128, 128, 3, 3),
                pool_shape=(2,2),
                pool_stride=(2,2),
                BN = BN,                     
                BN_epsilon=BN_epsilon,
                binary_training=binary_training, 
                stochastic_training=stochastic_training,
                binary_test=binary_test, 
                stochastic_test=stochastic_test
            ))
            
            print "    C2 layer:"
                
            self.layer.append(ReLU_conv_layer(
                rng,
                filter_shape=(256, 128, 2, 2),
                pool_shape=(1,1),
                pool_stride=(1,1),
                BN = BN,                     
                BN_epsilon=BN_epsilon,
                binary_training=binary_training, 
                stochastic_training=stochastic_training,
                binary_test=binary_test, 
                stochastic_test=stochastic_test
            ))
            
            print "    C2 P2 layers:"
            
            self.layer.append(ReLU_conv_layer(
                rng,
                filter_shape=(256, 256, 2, 2),
                pool_shape=(2,2),
                pool_stride=(2,2),
                BN = BN,                     
                BN_epsilon=BN_epsilon,
                binary_training=binary_training, 
                stochastic_training=stochastic_training,
                binary_test=binary_test, 
                stochastic_test=stochastic_test
            ))
            
            print "    C2 layer:"
                
            self.layer.append(ReLU_conv_layer(
                rng,
                filter_shape=(512, 256, 2, 2),
                pool_shape=(1,1),
                pool_stride=(1,1),
                BN = BN,                     
                BN_epsilon=BN_epsilon,
                binary_training=binary_training, 
                stochastic_training=stochastic_training,
                binary_test=binary_test, 
                stochastic_test=stochastic_test
            ))
            
            print "    C2 P2 layers:"
            
            self.layer.append(ReLU_conv_layer(
                rng,
                filter_shape=(512, 512, 2, 2),
                pool_shape=(2,2),
                pool_stride=(2,2),
                BN = BN,                     
                BN_epsilon=BN_epsilon,
                binary_training=binary_training, 
                stochastic_training=stochastic_training,
                binary_test=binary_test, 
                stochastic_test=stochastic_test
            ))
            
            print "    C2 layer:"
                
            self.layer.append(ReLU_conv_layer(
                rng,
                filter_shape=(1024, 512, 2, 2),
                pool_shape=(1,1),
                pool_stride=(1,1),
                BN = BN,                     
                BN_epsilon=BN_epsilon,
                binary_training=binary_training, 
                stochastic_training=stochastic_training,
                binary_test=binary_test, 
                stochastic_test=stochastic_test
            ))
            
            print "    FC layer:"
            
            self.layer.append(ReLU_layer(
                    rng = rng, 
                    n_inputs = 1024, 
                    n_units = 1024, 
                    BN = BN, 
                    BN_epsilon=BN_epsilon, 
                    dropout=dropout_hidden, 
                    binary_training=binary_training, 
                    stochastic_training=stochastic_training,
                    binary_test=binary_test, 
                    stochastic_test=stochastic_test
            ))
            
            print "    L2 SVM layer:"
            
            self.layer.append(linear_layer(
                rng = rng, 
                n_inputs= 1024, 
                n_units = 10, 
                BN = BN,
                BN_epsilon=BN_epsilon,
                dropout = dropout_hidden,
                binary_training=binary_training, 
                stochastic_training=stochastic_training,
                binary_test=binary_test, 
                stochastic_test=stochastic_test
            ))