-
Notifications
You must be signed in to change notification settings - Fork 25
Compartments
Randall O'Reilly edited this page Aug 9, 2020
·
1 revision
This is code in leabra
for treating a particular projection type (emer.Forward
) as a separately modulated input. The standard leabra
code also contains separate integration of inhibition vs. excitation, which is similar, but this is how you can do it separately:
// RecvGIncPrjn increments the receiver's GeRaw or GiRaw from that of all the projections.
// Increments GeFwd separate from rest of GeRaw.
func (ly *AttnLayer) RecvGIncPrjn(pj *leabra.Prjn, ltime *leabra.Time) {
if ly.Attn.GeMin < 1 && pj.Typ == emer.Forward {
for ri := range ly.Neurons {
gfw := &ly.GeFwds[ri]
*gfw += pj.GInc[ri]
pj.GInc[ri] = 0
}
} else {
pj.LeabraPrj.RecvGInc()
}
}
// RecvGInc rewritten to use the above layer-level method instead of going straight to the Prjn
func (ly *AttnLayer) RecvGInc(ltime *leabra.Time) {
for _, p := range ly.RcvPrjns {
if p.IsOff() {
continue
}
ly.RecvGIncPrjn(p.(leabra.LeabraPrjn).AsLeabra(), ltime)
}
}
// GFmIncNeur is the neuron-level code for GFmInc that integrates overall Ge, Gi values
// from their G*Raw accumulators.
func (ly *AttnLayer) GFmIncNeur(ltime *leabra.Time) {
for ni := range ly.Neurons {
nrn := &ly.Neurons[ni]
if nrn.IsOff() {
continue
}
attn := ly.Attns[nrn.SubPool]
geRaw := nrn.GeRaw + ly.Attn.GeMod(ly.GeFwds[ni], attn) // separately modulating GeFwds by attention
ly.Act.GeFmRaw(nrn, geRaw)
ly.Act.GiFmRaw(nrn, nrn.GiRaw)
}
}
// GFmInc integrates new synaptic conductances from increments sent during last SendGDelta.
func (ly *AttnLayer) GFmInc(ltime *leabra.Time) {
ly.RecvGInc(ltime)
ly.GFmIncNeur(ltime)
}
test