Ejemplo n.º 1
0
    def __init__(self, netParams, input_channels=3):
        super(SlayerVgg16, self).__init__()
        # initialize slayer
        slayer = snn.layer(netParams['neuron'], netParams['simulation'])
        self.slayer = slayer
        # define network functions
        self.conv1a = slayer.conv(input_channels, 16, 5, padding=2)
        self.conv2a = slayer.conv(16, 16, 3, padding=1)
        self.poola = slayer.pool(2)

        self.conv1b = slayer.conv(16, 32, 3, padding=1)
        self.conv2b = slayer.conv(32, 32, 3, padding=1)
        self.poolb = slayer.pool(2)

        self.conv1c = slayer.conv(32, 64, 3, padding=1)
        self.conv2c = slayer.conv(64, 64, 3, padding=1)
        self.conv3c = slayer.conv(64, 64, 3, padding=1)
        self.poolc = slayer.pool(2)

        self.conv1d = slayer.conv(64, 128, 3, padding=1)
        self.conv2d = slayer.conv(128, 128, 3, padding=1)
        self.conv3d = slayer.conv(128, 128, 3, padding=1)
        self.poold = slayer.pool(2)

        self.conv1e = slayer.conv(128, 256, 3, padding=1)
        self.conv2e = slayer.conv(256, 256, 3, padding=1)
        self.conv3e = slayer.conv(256, 256, 3, padding=1)
        self.poole = slayer.pool(2)

        self.fc1 = slayer.dense((1, 1, 256), 4096)
        self.fc2 = slayer.dense(4096, 4096)
        self.fc3 = slayer.dense(4096, 1000)
        self.fc4 = slayer.dense(1000, 10)
Ejemplo n.º 2
0
 def __init__(self, netParams):
     super(Network, self).__init__()
     # Initialize slayer
     slayer = snn.layer(netParams['neuron'], netParams['simulation'])
     self.slayer = slayer
     # Define network functions
     # The commented line below should be used if the input spikes were not reshaped
     # self.fc1   = slayer.dense((34, 34, 2), 512)
     self.fc1 = slayer.dense((34 * 34 * 2), 512)
     self.fc2 = slayer.dense(512, 10)
Ejemplo n.º 3
0
 def __init__(self,
              netParams,
              output_size=28 * 28,
              hidden_size=200,
              latent_size=2,
              vae=False):
     super(Decoder, self).__init__()
     slayer = snn.layer(netParams['neuron'], netParams['simulation'])
     self.vae = vae
     self.slayer = slayer
     self.fc1 = slayer.dense(latent_size, hidden_size)
     self.fc2 = slayer.dense(hidden_size, output_size)
Ejemplo n.º 4
0
 def __init__(self, netParams):
     super(Network, self).__init__()
     # initialize slayer
     slayer = snn.layer(netParams['neuron'], netParams['simulation'])
     self.slayer = slayer
     # define network functions
     self.conv1 = slayer.conv(2, 16, 5, padding=1)
     self.conv2 = slayer.conv(16, 32, 3, padding=1)
     self.conv3 = slayer.conv(32, 64, 3, padding=1)
     self.pool1 = slayer.pool(2)
     self.pool2 = slayer.pool(2)
     self.fc1 = slayer.dense((8, 8, 64), 10)
Ejemplo n.º 5
0
 def __init__(self, netParams, input_channels=3):
     super(SlayerSNN2, self).__init__()
     # initialize slayer
     slayer = snn.layer(netParams['neuron'], netParams['simulation'])
     self.slayer = slayer
     # define network functions
     self.conv1 = slayer.conv(input_channels, 16, 5, padding=2)
     self.conv2 = slayer.conv(16, 32, 3, padding=1)
     self.conv3 = slayer.conv(32, 64, 3, padding=1)
     self.pool1 = slayer.pool(2)
     self.pool2 = slayer.pool(2)
     self.fc1 = slayer.dense((7, 7, 64), 10)
Ejemplo n.º 6
0
 def __init__(self, netParams):
     super(UpsamplingAutoencoder, self).__init__()
     # initialize slayer
     slayer = snn.layer(netParams['neuron'], netParams['simulation'])
     self.slayer = slayer
     # define network functions
     self.conv1 = slayer.conv(1, 16, 5, padding=2)
     self.pool1 = slayer.pool(2)
     self.conv2 = slayer.conv(16, 32, 3, padding=1)
     self.pool2 = slayer.pool(2)
     self.conv3 = slayer.conv(32, 64, 3, padding=1)
     self.unpool3 = slayer.upsampling2d(2, mode='bilinear')
     self.conv4 = slayer.conv(64, 32, 3, padding=1)
     self.unpool4 = slayer.upsampling2d(2, mode='bilinear')
     self.convOut = slayer.conv(32, 1, 1, padding=0)
Ejemplo n.º 7
0
 def __init__(self,
              netParams,
              input_size=(28, 28, 1),
              hidden_size=200,
              latent_size=2,
              vae=False):
     super(Encoder, self).__init__()
     slayer = snn.layer(netParams['neuron'], netParams['simulation'])
     self.vae = vae
     self.slayer = slayer
     self.fc1 = slayer.dense(input_size, hidden_size)
     if vae:
         self.fc_mean = slayer.dense(hidden_size, latent_size)
         self.fc_log_var = slayer.dense(hidden_size, latent_size)
     else:
         self.fc2 = slayer.dense(hidden_size, latent_size)
Ejemplo n.º 8
0
 def __init__(self, netParams, input_channels=3):
     super(encoderSpikes, self).__init__()
     # initialize slayer
     slayer = snn.layer(netParams['neuron'], netParams['simulation'])
     self.slayer = slayer