コード例 #1
0
 def __init__(self,
              filters,
              pool_size,
              conv_size,
              pool_strides=None,
              conv_strides=None,
              conv_padding='valid',
              connectivity_type='procedural'):
     super(AvePool2DConv2DSynapses, self).__init__()
     self.filters = filters
     self.pool_size = _get_param_2d('pool_size', pool_size)
     self.conv_size = _get_param_2d('conv_size', conv_size)
     self.pool_strides = _get_param_2d('pool_strides',
                                       pool_strides,
                                       default=self.pool_size)
     self.conv_strides = _get_param_2d('conv_strides',
                                       conv_strides,
                                       default=(1, 1))
     self.conv_padding = PadMode(conv_padding)
     self.pool_output_shape = None
     self.connectivity_type = ConnectivityType(connectivity_type)
     if self.pool_strides[0] < self.pool_size[0] or self.pool_strides[
             1] < self.pool_size[1]:
         raise NotImplementedError(
             'pool stride < pool size is not supported')
     if self.conv_strides[0] != 1 or self.conv_strides[1] != 1:
         raise NotImplementedError('conv stride != 1 is not supported')
     if self.connectivity_type is ConnectivityType.TOEPLITZ:
         if self.conv_padding is PadMode.SAME:
             if (self.conv_size[0] % 2) == 0 or (self.conv_size[1] %
                                                 2) == 0:
                 raise NotImplementedError(
                     'Toeplitz with same conv_padding and even conv_size is not supported'
                 )
コード例 #2
0
 def __init__(self, pool_size, pool_strides=None,
              connectivity_type='procedural'):
     super(AvePool2DSynapses, self).__init__()
     self.pool_size = _get_param_2d('pool_size', pool_size)
     self.pool_strides = _get_param_2d('pool_strides', pool_strides, default=self.pool_size)
     self.connectivity_type = ConnectivityType(connectivity_type)
     if self.pool_strides[0] < self.pool_size[0] or self.pool_strides[1] < self.pool_size[1]:
         raise NotImplementedError('pool stride < pool size is not supported')
コード例 #3
0
ファイル: conv2d.py プロジェクト: genn-team/ml_genn
 def __init__(self, name, filters, conv_size, conv_strides=None,
              conv_padding='valid', connectivity_type='procedural', neurons=IFNeurons()):
     super(Conv2D, self).__init__(name, neurons)
     self.filters = filters
     self.conv_size = _get_param_2d('conv_size', conv_size)
     self.conv_strides = _get_param_2d('conv_strides', conv_strides, default=(1, 1))
     self.conv_padding = PadMode(conv_padding)
     self.connectivity_type = ConnectivityType(connectivity_type)
コード例 #4
0
ファイル: avepool2d.py プロジェクト: genn-team/ml_genn
 def __init__(self,
              name,
              pool_size,
              pool_strides=None,
              pool_padding='valid',
              connectivity_type='procedural',
              neurons=IFNeurons()):
     super(AvePool2D, self).__init__(name, neurons)
     self.pool_size = _get_param_2d('pool_size', pool_size)
     self.pool_strides = _get_param_2d('pool_strides',
                                       pool_strides,
                                       default=self.pool_size)
     self.pool_padding = PadMode(pool_padding)
     self.connectivity_type = ConnectivityType(connectivity_type)
コード例 #5
0
 def __init__(self,
              filters,
              conv_size,
              conv_strides=None,
              conv_padding='valid',
              connectivity_type='procedural'):
     super(ConvTranspose2DSynapses, self).__init__()
     self.filters = filters
     self.conv_size = _get_param_2d('conv_size', conv_size)
     self.conv_strides = _get_param_2d('conv_strides',
                                       conv_strides,
                                       default=(1, 1))
     self.conv_padding = PadMode(conv_padding)
     self.connectivity_type = ConnectivityType(connectivity_type)