Backend
Backend
is the core component of the backend of the SPAIC platform and is responsible for the overall running simulation of the network. dt
and runtime
are the two most important parameters in backend, representing the time step and the length of the time window of the simulation, respectively. And time
represents the moment that currently simulated, and n_time_step
represents the time step that is currently simulated.
The functions available to users in Backend
are:
set_runtime – sets the length of the time window, or the length of the simulation
add_variable – adds variables to the backend. When customizing the algorithm, you need to add new variables to the
Backend
add_operation – adds a new calculation formula to the backend for custom algorithms, neurons and other operations, and needs to follow a certain format
register_standalone – registers independent operations, mainly used to add some operations that are not supported by the platform to the backend
register_initial – registers the initialization operation. The calculation in the initialization operation will be calculated once at the beginning of each time window, instead of every
dt
as the time step runs.
add_variable
When using add_variable
, the parameters that must be added are name
与 shape
, and the optional parameters are value
, is_parameter
, is_sparse
, init
,
min
andmax
.
name
decodes the key
when save on the backend,and shape
decides the shape, value
represent the value,init
decides the value that everytime the variable initialized, is_parameter
decides whether this variable is trainable or not.
add_operation
When using add_operation
, the parameters that must be added is op
. op
is used to load operations that backend need to calculate. It will put the operation given by users into the computing
graph. It is mainly used for custom computation.