Пример #1
0
    def __init__(self, D_in, H1, H2, D_out, weights=''):
        self.FC1 = nn_layer.FC(D_in, H1)
        self.ReLU1 = activation.ReLU()
        self.FC2 = nn_layer.FC(H1, H2)
        self.ReLU2 = activation.ReLU()
        self.FC3 = nn_layer.FC(H2, D_out)

        if weights == '':
            pass
        else:
            # Load weights from file
            with open(weights, 'rb') as f:
                params = pickle.load(f)
                self.set_params(params)
    def __init__(self, D_in, H, D_out, weights=''):
        '''
    D_in: input feature dimension
    H:    number of hidden neurons, output dimension of first FC layer and input dimension of second FC layer
    D_out: output dimension, which is 10 for digit recognition.
    '''
        self.FC1 = nn_layer.FC(D_in, H)
        self.ReLU1 = activation.ReLU()
        self.FC2 = nn_layer.FC(H, D_out)

        if weights == '':
            pass
        else:
            # Load weights from file
            with open(weights, 'rb') as f:
                params = pickle.load(f)
                self.set_params(params)
Пример #3
0
  def __init__(self):
    self.Cin = 1
    self.D_out = 10
    # Cin: input channel
    # Cout: output channel
    # F: kernel size 3x3
    # Conv1: Cin=1, Cout=6, F=3
    self.conv1 = conv_layer.Conv (self.Cin, 6, 3)
    self.ReLU1 = activation.ReLU ()
    self.pool1 = pooling.MaxPool (2,2)
    # Conv2: Cin=6, Cout=16, F=3
    self.conv2 = conv_layer.Conv (6, 16, 3)
    self.ReLU2 = activation.ReLU ()
    self.pool2 = pooling.MaxPool (2,2)
    # FC1 flatten to be 64*784
    self.FC1 = nn_layer.FC(784, 120)
    self.ReLU3 = activation.ReLU ()
    self.FC2 = nn_layer.FC (120, 84)
    self.ReLU4 = activation.ReLU ()
    self.FC3 = nn_layer.FC (84, self.D_out)
    self.Softmax = activation.Softmax ()

    self.p2_shape = None
 def __init__(self, D_in, H1, H2, D_out, weights=''):
     self.FC1 = nn_layer.FC(D_in, H1)
     self.ReLU1 = activation.ReLU()
     self.FC2 = nn_layer.FC(H1, H2)
     self.ReLU2 = activation.ReLU()
     self.FC3 = nn_layer.FC(H2, D_out)