@@ -277,8 +277,7 @@ func (pj *PathParams) GatherSpikes(ctx *Context, ly *LayerParams, ni, di uint32,
277277// DoSynCa returns false if should not do synaptic-level calcium updating.
278278// Done by default in Cortex, not for some other special pathway types.
279279func (pj * PathParams ) DoSynCa () bool {
280- if pj .PathType == RWPath || pj .PathType == TDPredPath || pj .PathType == VSMatrixPath ||
281- pj .PathType == DSMatrixPath || pj .PathType == VSPatchPath || pj .PathType == BLAPath {
280+ if pj .Learn .Trace .SynCa != StdSynCa || pj .PathType == RWPath || pj .PathType == TDPredPath || pj .PathType == VSMatrixPath || pj .PathType == DSMatrixPath || pj .PathType == VSPatchPath || pj .PathType == BLAPath || pj .Learn .Hebb .On .IsTrue () {
282281 return false
283282 }
284283 return true
@@ -338,28 +337,36 @@ func (pj *PathParams) DWtSyn(ctx *Context, syni, si, ri, di uint32, layPool, sub
338337// Uses synaptically integrated spiking, computed at the Theta cycle interval.
339338// This is the trace version for hidden units, and uses syn CaP - CaD for targets.
340339func (pj * PathParams ) DWtSynCortex (ctx * Context , syni , si , ri , di uint32 , layPool , subPool * Pool , isTarget bool ) {
341- // credit assignment part
342- caUpT := SynCaV (ctx , syni , di , CaUpT ) // time of last update
343- syCaM := SynCaV (ctx , syni , di , CaM ) // fast time scale
344- syCaP := SynCaV (ctx , syni , di , CaP ) // slower but still fast time scale, drives Potentiation
345- syCaD := SynCaV (ctx , syni , di , CaD ) // slow time scale, drives Depression (one trial = 200 cycles)
346- pj .Learn .KinaseCa .CurCa (ctx .SynCaCtr , caUpT , & syCaM , & syCaP , & syCaD ) // always update, getting current Ca (just optimization)
347-
348- rb0 := NrnV (ctx , ri , di , SpkBin0 )
349- sb0 := NrnV (ctx , si , di , SpkBin0 )
350- rb1 := NrnV (ctx , ri , di , SpkBin1 )
351- sb1 := NrnV (ctx , si , di , SpkBin1 )
352- rb2 := NrnV (ctx , ri , di , SpkBin2 )
353- sb2 := NrnV (ctx , si , di , SpkBin2 )
354- rb3 := NrnV (ctx , ri , di , SpkBin3 )
355- sb3 := NrnV (ctx , si , di , SpkBin3 )
356-
357- b0 := 0.1 * (rb0 * sb0 )
358- b1 := 0.1 * (rb1 * sb1 )
359- b2 := 0.1 * (rb2 * sb2 )
360- b3 := 0.1 * (rb3 * sb3 )
361-
362- pj .Learn .KinaseCa .FinalCa (b0 , b1 , b2 , b3 , & syCaM , & syCaP , & syCaD )
340+ var syCaM , syCaP , syCaD , caUpT float32
341+ switch pj .Learn .Trace .SynCa {
342+ case StdSynCa :
343+ caUpT = SynCaV (ctx , syni , di , CaUpT ) // time of last update
344+ syCaM = SynCaV (ctx , syni , di , CaM ) // fast time scale
345+ syCaP = SynCaV (ctx , syni , di , CaP ) // slower but still fast time scale, drives Potentiation
346+ syCaD = SynCaV (ctx , syni , di , CaD ) // slow time scale, drives Depression (one trial = 200 cycles)
347+ pj .Learn .KinaseCa .CurCa (ctx .SynCaCtr , caUpT , & syCaM , & syCaP , & syCaD ) // always update, getting current Ca (just optimization)
348+ case LinearSynCa :
349+ rb0 := NrnV (ctx , ri , di , SpkBin0 )
350+ sb0 := NrnV (ctx , si , di , SpkBin0 )
351+ rb1 := NrnV (ctx , ri , di , SpkBin1 )
352+ sb1 := NrnV (ctx , si , di , SpkBin1 )
353+ rb2 := NrnV (ctx , ri , di , SpkBin2 )
354+ sb2 := NrnV (ctx , si , di , SpkBin2 )
355+ rb3 := NrnV (ctx , ri , di , SpkBin3 )
356+ sb3 := NrnV (ctx , si , di , SpkBin3 )
357+
358+ b0 := 0.1 * (rb0 * sb0 )
359+ b1 := 0.1 * (rb1 * sb1 )
360+ b2 := 0.1 * (rb2 * sb2 )
361+ b3 := 0.1 * (rb3 * sb3 )
362+
363+ pj .Learn .KinaseCa .FinalCa (b0 , b1 , b2 , b3 , & syCaM , & syCaP , & syCaD )
364+ case NeurSynCa :
365+ gain := float32 (1.0 )
366+ syCaM = gain * NrnV (ctx , si , di , CaSpkM ) * NrnV (ctx , ri , di , CaSpkM )
367+ syCaP = gain * NrnV (ctx , si , di , CaSpkP ) * NrnV (ctx , ri , di , CaSpkP )
368+ syCaD = gain * NrnV (ctx , si , di , CaSpkD ) * NrnV (ctx , ri , di , CaSpkD )
369+ }
363370
364371 SetSynCaV (ctx , syni , di , CaM , syCaM )
365372 SetSynCaV (ctx , syni , di , CaP , syCaP )
0 commit comments