def __init__(self, pre, post, target, window=0.0): """ *Parameters*: * **pre**: pre-synaptic population. * **post**: post-synaptic population. * **target**: type of the connection. * **window**: duration of the time window to collect spikes (default: dt). """ Projection.__init__(self, pre, post, target, None) # Check populations if not self.pre.neuron_type.type == 'spike': Global._error( 'The pre-synaptic population of a DecodingProjection must be spiking.' ) exit(0) if not self.post.neuron_type.type == 'rate': Global._error( 'The post-synaptic population of a DecodingProjection must be rate-coded.' ) exit(0) # Process window argument if window == 0.0: window = Global.config['dt'] self.window = window
def __init__(self, pre, post, target, psp="pre.r * w", operation="sum", name=None, copied=False): """ :param pre: pre-synaptic population (either its name or a ``Population`` object). :param post: post-synaptic population (either its name or a ``Population`` object). :param target: type of the connection :param psp: continuous influence of a single synapse on the post-synaptic neuron (default for rate-coded: ``w*pre.r``). :param operation: operation (sum, max, min, mean) performed by the kernel (default: sum). """ # Create the description, but it will not be used for generation Projection.__init__(self, pre=pre, post=post, target=target, synapse=SharedSynapse(psp=psp, operation=operation), name=name, copied=copied)
def __init__(self, pre, post, target, psp="w * pre.r", operation="sum"): """ Projection based on shared weights: each post-synaptic neuron uses the same weights, so they need to be instantiated only once to save memory. Learning is not possible for now. The ``synapse`` argument is removed, replaced by a single ``psp`` argument to modified what is summed and ``operation`` to replace the summation operation by max-pooling or similar.. *Parameters*: * **pre**: pre-synaptic population (either its name or a ``Population`` object). * **post**: post-synaptic population (either its name or a ``Population`` object). * **target**: type of the connection. * **psp**: function to be summed. By default: ``w * pre.r`` * **operation**: function applied on ``psp`` ("sum", "max", "min", "mean"). "sum" is the default. """ # Create the description, but it will not be used for generation Projection.__init__( self, pre, post, target, synapse = SharedSynapse(psp=psp, operation=operation) ) self._omp_config['psp_schedule'] = 'schedule(dynamic)' if not Global.config["paradigm"] == "openmp": Global._error('Weight sharing is only implemented for the OpenMP paradigm.') exit(0) if not pre.neuron_type.type == 'rate': Global._error('Weight sharing is only implemented for rate-coded populations.') exit(0)
def __init__(self, pre, post, target, name=None, copied=False): """ :param pre: pre-synaptic population (either its name or a ``Population`` object). :param post: post-synaptic population (either its name or a ``Population`` object). :param target: type of the connection. """ # Create the description, but it will not be used for generation Projection.__init__(self, pre, post, target, name=name, copied=copied)
def __init__(self, pre, post, target): """ *Parameters*: * **pre**: pre-synaptic population (either its name or a ``Population`` object). * **post**: post-synaptic population (either its name or a ``Population`` object). * **target**: type of the connection. """ # Create the description, but it will not be used for generation Projection.__init__(self, pre, post, target)
def __init__(self, pre, post, target, operation="max", name=None, copied=False): """ :param pre: pre-synaptic population (either its name or a ``Population`` object). :param post: post-synaptic population (either its name or a ``Population`` object). :param target: type of the connection :param operation: pooling function to be applied ("max", "min", "mean") """ if not operation in ["max", "mean", "min"]: Global._error( "Pooling: the operation must be either 'max', 'mean' or 'min'." ) self.operation = operation Projection.__init__( self, pre, post, target, synapse=SharedSynapse( psp="pre.r", operation=operation, name="Pooling operation", description=operation + "-pooling operation over the pre-synaptic population."), name=name, copied=copied) if not pre.neuron_type.type == 'rate': Global._error( 'Pooling: only implemented for rate-coded populations.') # check dimensions of populations, should not exceed 4 self.dim_pre = self.pre.dimension self.dim_post = self.post.dimension if self.dim_post > 4: Global._error( 'Pooling: Too many dimensions for the post-synaptic population (maximum 4).' ) if self.dim_pre > 4: Global._error( 'Pooling: Too many dimensions for the pre-synaptic population (maximum 4).' ) # Disable saving self._saveable = False
def __init__(self, pre, post, target): """ *Parameters*: * **pre**: pre-synaptic population (either its name or a ``Population`` object). * **post**: post-synaptic population (either its name or a ``Population`` object). * **target**: type of the connection. """ # Create the description, but it will not be used for generation Projection.__init__( self, pre, post, target )
def __init__(self, pre, post, target, synapse=None, name=None, copied=False): """ Initialization, receive parameters of Projection objects. :param pre: pre-synaptic population. :param post: post-synaptic population. :param target: type of the connection. :param window: duration of the time window to collect spikes (default: dt). """ Projection.__init__(self, pre=pre, post=post, target=target, synapse=synapse, name=name, copied=copied)
def __init__(self, pre, post, target, window=0.0): """ *Parameters*: * **pre**: pre-synaptic population. * **post**: post-synaptic population. * **target**: type of the connection. * **window**: duration of the time window to collect spikes (default: dt). """ Projection.__init__(self, pre, post, target, None) # Check populations if not self.pre.neuron_type.type == 'spike': Global._error('The pre-synaptic population of a DecodingProjection must be spiking.') exit(0) if not self.post.neuron_type.type == 'rate': Global._error('The post-synaptic population of a DecodingProjection must be rate-coded.') exit(0) # Process window argument if window == 0.0: window = Global.config['dt'] self.window = window
def __init__(self, pre, post, target, psp="pre.r * w", operation="sum", name=None, copied=False): """ :param pre: pre-synaptic population (either its name or a ``Population`` object). :param post: post-synaptic population (either its name or a ``Population`` object). :param target: type of the connection :param psp: continuous influence of a single synapse on the post-synaptic neuron (default for rate-coded: ``w*pre.r``). :param operation: operation (sum, max, min, mean) performed by the kernel (default: sum). """ # Create the description, but it will not be used for generation Projection.__init__( self, pre, post, target, synapse=SharedSynapse( psp=psp, operation=operation, name="Convolution operation", description= "Convoluted kernel over the pre-synaptic population."), name=name, copied=copied) # Disable saving self._saveable = False # For copy self._used_single_filter = False self._used_bank_of_filters = False self.operation = operation
def __init__(self, proj, target): """ :param proj: original projection :param target: type of the connection (can differ from the original one) """ # Transpose is not intended for hybrid projections if proj.pre.neuron_type.type == "rate" and proj.post.neuron_type.type == "rate": Projection.__init__(self, pre=proj.post, post=proj.pre, target=target, synapse=DefaultRateCodedSynapse) elif proj.pre.neuron_type.type == "spike" and proj.post.neuron_type.type == "spike": Projection.__init__(self, pre=proj.post, post=proj.pre, target=target, synapse=DefaultSpikingSynapse) else: Global._error( 'TransposeProjection are not applyable on hybrid projections ...' ) # in the code generation we directly access properties of the # forward projection. Therefore we store the link here to have access in # self._generate() self.fwd_proj = proj if (proj._connection_delay > 0.0): Global._error( 'TransposeProjection can not be applied on delayed projections yet ...' ) # simply copy from the forward view self.delays = proj._connection_delay self.max_delay = proj.max_delay self.uniform_delay = proj.uniform_delay
def __init__(self, pre, post, target, operation="max", extent=None, delays=0.0, name=None, copied=False): """ :param pre: pre-synaptic population (either its name or a ``Population`` object). :param post: post-synaptic population (either its name or a ``Population`` object). :param target: type of the connection :param operation: pooling function to be applied ("max", "min", "mean") :param extent: extent of the pooling area expressed in the geometry of the pre-synaptic population. In each dimension, the product of this extent with the number of neurons in the post-synaptic population must be equal to the number of pre-synaptic neurons. :param delays: synaptic delay in ms """ self.operation = operation Projection.__init__(self, pre, post, target, synapse=SharedSynapse(psp="pre.r", operation=operation), name=name, copied=copied) if not pre.neuron_type.type == 'rate': Global._error( 'SharedProjection: Weight sharing is only implemented for rate-coded populations.' ) # process extent self.extent_init = extent if extent is None: # compute the extent automatically if self.pre.dimension != self.post.dimension: Global._error( 'PoolingProjection: If you do not provide the extent parameter, the two populations must have the same dimensions.' ) extent = list(self.pre.geometry) for dim in range(self.pre.dimension): extent[dim] /= self.post.geometry[dim] if self.pre.geometry[ dim] != extent[dim] * self.post.geometry[dim]: Global._error( 'PoolingProjection: Unable to compute the extent of the pooling area: the number of neurons do not match.' ) elif not isinstance(extent, tuple): Global._error( 'SharedProjection: You must provide a tuple for the extent of the pooling operation.' ) self.extent = list(extent) if len(self.extent) < self.pre.dimension: Global._error( 'SharedProjection: You must provide a tuple for the extent of the pooling operation.' ) # process delays self.delays = delays # check dimensions of populations, should not exceed 4 self.dim_pre = self.pre.dimension self.dim_post = self.post.dimension if self.dim_post > 4: Global._error( 'SharedProjection: Too many dimensions for the post-synaptic population (maximum 4).' ) if self.dim_pre > 4: Global._error( 'SharedProjection: Too many dimensions for the pre-synaptic population (maximum 4).' ) # Disable saving self._saveable = False # create fake LIL self._create() # Generate the pre-synaptic coordinates self._generate_extent_coordinates()
def __init__(self, pre, post, target, operation="max", extent=None, delays=0.0, name=None, copied=False): """ :param pre: pre-synaptic population (either its name or a ``Population`` object). :param post: post-synaptic population (either its name or a ``Population`` object). :param target: type of the connection :param operation: pooling function to be applied ("max", "min", "mean") :param extent: extent of the pooling area expressed in the geometry of the pre-synaptic population. In each dimension, the product of this extent with the number of neurons in the post-synaptic population must be equal to the number of pre-synaptic neurons. :param delays: synaptic delay in ms """ self.operation = operation Projection.__init__( self, pre, post, target, synapse=SharedSynapse(psp="pre.r", operation=operation), name=name, copied=copied ) if not pre.neuron_type.type == 'rate': Global._error('SharedProjection: Weight sharing is only implemented for rate-coded populations.') # process extent self.extent_init = extent if extent is None: # compute the extent automatically if self.pre.dimension != self.post.dimension: Global._error( 'PoolingProjection: If you do not provide the extent parameter, the two populations must have the same dimensions.') extent = list(self.pre.geometry) for dim in range(self.pre.dimension): extent[dim] /= self.post.geometry[dim] if self.pre.geometry[dim] != extent[dim] * self.post.geometry[dim]: Global._error( 'PoolingProjection: Unable to compute the extent of the pooling area: the number of neurons do not match.') elif not isinstance(extent, tuple): Global._error('SharedProjection: You must provide a tuple for the extent of the pooling operation.') self.extent = list(extent) if len(self.extent) < self.pre.dimension: Global._error('SharedProjection: You must provide a tuple for the extent of the pooling operation.') # process delays self.delays = delays # check dimensions of populations, should not exceed 4 self.dim_pre = self.pre.dimension self.dim_post = self.post.dimension if self.dim_post > 4: Global._error('SharedProjection: Too many dimensions for the post-synaptic population (maximum 4).') if self.dim_pre > 4: Global._error('SharedProjection: Too many dimensions for the pre-synaptic population (maximum 4).') # Disable saving self._saveable = False # create fake LIL self._create() # Generate the pre-synaptic coordinates self._generate_extent_coordinates()