Skip to content

Commit

Permalink
deep_fsa working as before -- decay state was nuking spike bin values
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoreilly committed Dec 1, 2024
1 parent f57a940 commit 143998b
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 37 deletions.
3 changes: 3 additions & 0 deletions axon/act-layer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions axon/act-layer.goal
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,9 @@ func (ly *LayerParams) NewStateNeuron(ctx *Context, ni, di uint32) {
ly.Acts.DecayState(ctx, ni, di, ly.Acts.Decay.Act, ly.Acts.Decay.Glong, ly.Acts.Decay.AHP)
// Note: synapse-level Ca decay happens in DWt
ly.Acts.KNaNewState(ctx, ni, di)
for i := range 8 {
Neurons[ni, di, SpkBin0+NeuronVars(i)] = 0.0
}
}

// Beta1Neuron does neuron level Beta1 updating.
Expand Down
3 changes: 0 additions & 3 deletions axon/act.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions axon/act.goal
Original file line number Diff line number Diff line change
Expand Up @@ -892,9 +892,6 @@ func (ac *ActParams) DecayState(ctx *Context, ni, di uint32, decay, glong, ahp f
Neurons[ni, di, ISIAvg] = -1.0
Neurons[ni, di, ActInt] = ac.Init.Act
Neurons[ni, di, Spiked] = 0.0
for i := range 8 {
Neurons[ni, di, SpkBin0+NeuronVars(i)] = 0.0
}

if decay > 0 { // no-op for most, but not all..
Neurons[ni, di, Spike] = 0.0
Expand Down
23 changes: 3 additions & 20 deletions axon/looper.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ func (vu *NetViewUpdate) GoUpdate(counters string) {
if !vu.ShouldUpdate() {
return
}
if vu.IsCycleUpdating() && vu.View.Options.Raster.On { // no update for raster
return
}
vu.View.Record(counters, -1) // -1 = default incrementing raster
vu.View.GoUpdateView()
}
Expand Down Expand Up @@ -274,23 +277,3 @@ func (vu *NetViewUpdate) RecordSyns() {
}
vu.View.RecordSyns()
}

// // LooperUpdatePlots adds plot update calls at each time level
// func LooperUpdatePlots(ls *looper.Stacks, gui *egui.GUI) {
// for _, st := range ls.Stacks {
// for t, loop := range st.Loops {
// curTime := t
// if curTime == etime.Cycle {
// loop.OnEnd.Add("GUI:UpdatePlot", func() {
// cyc := loop.Counter.Cur
// _ = cyc
// // gui.GoUpdateCyclePlot(m, cyc) // todo:
// })
// } else {
// loop.OnEnd.Add("GUI:UpdatePlot", func() {
// // gui.GoUpdatePlot(m, curTime) // todo:
// })
// }
// }
// }
// }
3 changes: 0 additions & 3 deletions axon/shaders/MinusPhasePost.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,6 @@ fn ActParams_DecayState(ac: ptr<function,ActParams>, ctx: ptr<function,Context>,
Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(ISIAvg))] = -1.0;
Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(ActInt))] = (*ac).Init.Act;
Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(Spiked))] = 0.0;
for (var i=0; i<8; i++) {
Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(SpkBin0 + NeuronVars(i)))] = 0.0;
}
if (decay > 0) { // no-op for most, but not all..
Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(Spike))] = 0.0;
Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(Act))] -= decay * (Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(Act))] - (*ac).Init.Act);
Expand Down
6 changes: 3 additions & 3 deletions axon/shaders/NewStateNeuron.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ fn LayerParams_NewStateNeuron(ly: ptr<function,LayerParams>, ctx: ptr<function,C
Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(SpkMaxCa))] = 0.0;
ActParams_DecayState(&(*ly).Acts, ctx, ni, di, (*ly).Acts.Decay.Act, (*ly).Acts.Decay.Glong, (*ly).Acts.Decay.AHP);
ActParams_KNaNewState(&(*ly).Acts, ctx, ni, di);
for (var i=0; i<8; i++) {
Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(SpkBin0 + NeuronVars(i)))] = 0.0;
}
}

///////////// import: "act-net.go"
Expand Down Expand Up @@ -276,9 +279,6 @@ fn ActParams_DecayState(ac: ptr<function,ActParams>, ctx: ptr<function,Context>,
Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(ISIAvg))] = -1.0;
Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(ActInt))] = (*ac).Init.Act;
Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(Spiked))] = 0.0;
for (var i=0; i<8; i++) {
Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(SpkBin0 + NeuronVars(i)))] = 0.0;
}
if (decay > 0) { // no-op for most, but not all..
Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(Spike))] = 0.0;
Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(Act))] -= decay * (Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(Act))] - (*ac).Init.Act);
Expand Down
3 changes: 0 additions & 3 deletions axon/shaders/PlusPhasePost.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,6 @@ fn ActParams_DecayState(ac: ptr<function,ActParams>, ctx: ptr<function,Context>,
Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(ISIAvg))] = -1.0;
Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(ActInt))] = (*ac).Init.Act;
Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(Spiked))] = 0.0;
for (var i=0; i<8; i++) {
Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(SpkBin0 + NeuronVars(i)))] = 0.0;
}
if (decay > 0) { // no-op for most, but not all..
Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(Spike))] = 0.0;
Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(Act))] -= decay * (Neurons[IndexF323D(Neurons[0], Neurons[1], Neurons[2], u32(ni),u32(di),u32(Act))] - (*ac).Init.Act);
Expand Down
2 changes: 1 addition & 1 deletion examples/deep_fsa/typegen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/ra25/typegen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 143998b

Please sign in to comment.