MaskedLinear#
- class brainpy.dnn.MaskedLinear(conn, weight, mask_fun=Identity0(mode=NonBatchingMode), sharding=None, mode=None, name=None)[source]#
Synaptic matrix multiplication with masked dense computation.
It performs the computation of:
\[y = x @ M\]where \(y\) is the postsynaptic value, \(x\) the presynaptic value, \(M\) the synaptic weight using a dense matrix.
>>> import brainpy as bp >>> l = bp.dnn.MaskedLinear(bp.conn.FixedProb(0.1, pre=100, post=100), >>> weight=0.1)
- Parameters:
conn (
TwoEndConnector
) – TwoEndConnector. The connection.weight (
Union
[float
,TypeVar
(ArrayType
,Array
,Variable
,TrainVar
,Array
,ndarray
),Callable
]) – Synaptic weights. Can be a scalar, array, or callable function.mask_fun (
Callable
) – Masking function.sharding (
Union
[Sequence
[str
],Device
,Sharding
,None
]) – The sharding strategy.