Sparse CF Projection learning function applying Hebbian learning to the weights in a projection.
Divisive normalisation computed on the GPU
Sparse CF Projection response function calculating the dot-product between incoming activities and CF weights. Uses GPU.
Bases: topo.sparse.sparsecf.SparseCFProjection
A projection composed of SparseConnectionFields from a Sheet into a ProjectionSheet, calculated using a GPU.
Any subclass has to implement the interface activate(self) that computes the response from the input and stores it in the activity array.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.8, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
param Boolean initialized (allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Activate using the specified response_fn and output_fn.
Apply the weights_output_fns to each unit.
Return the specified ConnectionField
Return the bounds of the specified ConnectionField.
alias of SparseConnectionField
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
For a SparseCFProjection, learn consists of calling the learning_fn.
Sparse CF Projection learning function applying Hebbian learning to the weights in a projection.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Estimates the size on the basis of the number non-zeros in the sparse matrix, asssuming indices and values are stored using 32-bit integers and floats respectively.
Returns number of nonzero weights.
Temporarily override plasticity of medium and long term internal state.
This function should be implemented by all subclasses so that it preserves the ability of the Projection to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state.
For instance, if new_plasticity_state is False, in a Projection with modifiable connection weights, the values of those weights should temporarily be made fixed and unchanging after this call. For a Projection with automatic normalization, homeostatic plasticity, or other features that depend on a history of events (rather than just the current item being processed), changes in those properties would be disabled temporarily. Setting the plasticity state to False is useful during analysis operations (e.g. map measurement) that would otherwise change the state of the underlying network.
Any process that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.
By default, this call simply calls override_plasticity_state() on the Projection’s output_fn, and sets the ‘plastic’ parameter to False.
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Returns the activity in a single projection
Remove this connection from its src’s list of out_connections and its dest’s list of in_connections.
Sparse CF Projection response function calculating the dot-product between incoming activities and CF weights. Uses GPU.
Restore previous plasticity state of medium and long term internal state after a override_plasticity_state call.
This function should be implemented by all subclasses to remove the effect of the most recent override_plasticity_state call, e.g. to reenable plasticity of any type that was disabled.
Generate a runnable command for creating this connection.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Pop the most recently pushed activity state of the stack.
Push the current activity state onto the stack.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Return a single connection field Image, for the unit located nearest to sheet coordinate (sheet_x,sheet_y).
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: topo.sheet.SettlingCFSheet
A SettlingCFSheet that makes it possible to calculate projection activities and learning in concurrent GPU streams. This is done by placing barriers before the ‘activate’ and ‘learn’ methods of the sheet that synchronize GPU streams.
Otherwise, behaves exactly the same as SettlingCFSheet.
Collect activity from each projection, combine it to calculate the activity for this sheet, and send the result out.
Subclasses may override this method to whatever it means to calculate activity in that subclass.
Return the number of items that have been saved by state_push().
Given arbitary sheet coordinates, return the sheet coordinates of the center of the closest unit.
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
The sheet’s true density (i.e. the xdensity, which is equal to the ydensity for a Sheet.)
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Call the learn() method on every Projection to the Sheet, and call the output functions (jointly if necessary).
Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.
Valid for scalar or array float_row and float_col.
Inverse of sheet2matrix().
Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.
NOTE: This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.
Valid only for scalar or array row and col.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Estimate the memory bytes taken by this Sheet and its Projections.
Typically, this number will include the activity array and any similar arrays, plus memory taken by all incoming Projections. It will not usually include memory taken by the Python dictionary or various “housekeeping” attributes, which usually contribute only a small amount to the memory requirements. Thus this value should be considered only a rough lower bound from which memory requirements and memory usage patterns can be estimated.
Subclasses should reimplement this method if they store a significant amount of data other than in the activity array and the projections.
Count the total size of all incoming projections, in number of connections.
Temporarily override plasticity state of medium and long term internal state.
This function should be implemented by all subclasses so that when new_plasticity_state=False, it preserves the ability of the ProjectionSheet to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state.
Any process that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.
By default, calls override_plasticity_state() on the ProjectionSheet’s output_fns and all of its incoming Projections, and also enables the ‘plastic’ parameter for this ProjectionSheet. The old value of the plastic parameter is saved to an internal stack to be restored by restore_plasticity_state().
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Provide the given input_activity to each in_projection that has a dest_port equal to the specified port, asking each one to compute its activity.
The sheet’s own activity is not calculated until activate() is called.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Pass the accumulated stimulation through self.output_fns and send it out on the default output port.
We need to synchronize before processing the projection activities or their weights, since they might be still running on the GPU.
Return either a named input p, or a dictionary {projection_name, projection} of all the in_connections for this ProjectionSheet.
A minor convenience function for finding projections by name; the sheet’s list of in_connections usually provides simpler access to the Projections.
Delete the dictionary entry with key entry ‘view_name’ to save memory.
Return an array of Y-coordinates corresponding to the rows of the activity matrix of the sheet, and an array of X-coordinates corresponding to the columns.
Generate a runnable command for creating this EventProcessor.
Send some data out to all connections on the given src_port.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.
Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.
Valid for scalar or array x and y.
Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it’s the other way round for y because the matrix row index increases as y decreases).
Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).
Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.
Valid for scalar or array x and y.
Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.
Return an array of x-coordinates and an array of y-coordinates corresponding to the activity matrix of the sheet.
Creates the list of UnitView objects for a particular unit in this CFSheet. (There is one UnitView for each Projection to this CFSheet).
Each UnitView is then added to the sheet_views of its source sheet. It returns the list of all UnitViews for the given unit.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
The spacing between elements in an underlying matrix representation, in the x direction.
The spacing between elements in an underlying matrix representation, in the y direction.