minor fix
This commit is contained in:
@@ -593,7 +593,7 @@ function validate(model, dataset, labelDict)
|
|||||||
thinkingPeriod = 16 # 1000-784 = 216
|
thinkingPeriod = 16 # 1000-784 = 216
|
||||||
predict = [0] |> device
|
predict = [0] |> device
|
||||||
|
|
||||||
n = length(trainData)
|
n = length(dataset)
|
||||||
println("n $n")
|
println("n $n")
|
||||||
p = Progress(n, dt=1.0) # minimum update interval: 1 second
|
p = Progress(n, dt=1.0) # minimum update interval: 1 second
|
||||||
for (imgBatch, labels) in dataset
|
for (imgBatch, labels) in dataset
|
||||||
|
|||||||
@@ -235,8 +235,7 @@ function lifForward( zit,
|
|||||||
phi[i1,i2,i3,i4] = 0
|
phi[i1,i2,i3,i4] = 0
|
||||||
|
|
||||||
# compute epsilonRec
|
# compute epsilonRec
|
||||||
epsilonRec[i1,i2,i3,i4] = (alpha[i1,i2,i3,i4] * epsilonRec[i1,i2,i3,i4]) +
|
epsilonRec[i1,i2,i3,i4] = (alpha[i1,i2,i3,i4] * epsilonRec[i1,i2,i3,i4])
|
||||||
(zit[i1,i2,i3,i4] * subscription[i1,i2,i3,i4])
|
|
||||||
|
|
||||||
else # refractory period is inactive
|
else # refractory period is inactive
|
||||||
recSignal[i1,i2,i3,i4] = wRec[i1,i2,i3,i4] * zit[i1,i2,i3,i4]
|
recSignal[i1,i2,i3,i4] = wRec[i1,i2,i3,i4] * zit[i1,i2,i3,i4]
|
||||||
@@ -386,13 +385,10 @@ function alifForward( zit,
|
|||||||
a[i1,i2,i3,i4] = rho[i1,i2,i3,i4] * a[i1,i2,i3,i4]
|
a[i1,i2,i3,i4] = rho[i1,i2,i3,i4] * a[i1,i2,i3,i4]
|
||||||
|
|
||||||
# compute epsilonRec
|
# compute epsilonRec
|
||||||
epsilonRec[i1,i2,i3,i4] = (alpha[i1,i2,i3,i4] * epsilonRec[i1,i2,i3,i4]) +
|
epsilonRec[i1,i2,i3,i4] = (alpha[i1,i2,i3,i4] * epsilonRec[i1,i2,i3,i4])
|
||||||
(zit[i1,i2,i3,i4] * subscription[i1,i2,i3,i4])
|
|
||||||
|
|
||||||
# compute epsilonRecA
|
# compute epsilonRecA
|
||||||
epsilonRecA[i1,i2,i3,i4] = (phi[i1,i2,i3,i4] * epsilonRec[i1,i2,i3,i4]) +
|
epsilonRecA[i1,i2,i3,i4] = (phi[i1,i2,i3,i4] * epsilonRec[i1,i2,i3,i4])
|
||||||
((rho[i1,i2,i3,i4] - (phi[i1,i2,i3,i4] * beta[i1,i2,i3,i4])) *
|
|
||||||
epsilonRecA[i1,i2,i3,i4])
|
|
||||||
|
|
||||||
# compute avth
|
# compute avth
|
||||||
avth[i1,i2,i3,i4] = vth[i1,i2,i3,i4] + (beta[i1,i2,i3,i4] * a[i1,i2,i3,i4])
|
avth[i1,i2,i3,i4] = vth[i1,i2,i3,i4] + (beta[i1,i2,i3,i4] * a[i1,i2,i3,i4])
|
||||||
@@ -534,8 +530,7 @@ function onForward( zit,
|
|||||||
phi[i1,i2,i3,i4] = 0
|
phi[i1,i2,i3,i4] = 0
|
||||||
|
|
||||||
# compute epsilonRec
|
# compute epsilonRec
|
||||||
epsilonRec[i1,i2,i3,i4] = (alpha[i1,i2,i3,i4] * epsilonRec[i1,i2,i3,i4]) +
|
epsilonRec[i1,i2,i3,i4] = (alpha[i1,i2,i3,i4] * epsilonRec[i1,i2,i3,i4])
|
||||||
(zit[i1,i2,i3,i4] * subscription[i1,i2,i3,i4])
|
|
||||||
|
|
||||||
else # refractory period is inactive
|
else # refractory period is inactive
|
||||||
recSignal[i1,i2,i3,i4] = zit[i1,i2,i3,i4] * wOut[i1,i2,i3,i4]
|
recSignal[i1,i2,i3,i4] = zit[i1,i2,i3,i4] * wOut[i1,i2,i3,i4]
|
||||||
|
|||||||
22
src/learn.jl
22
src/learn.jl
@@ -9,7 +9,10 @@ using ..type, ..snnUtil
|
|||||||
#------------------------------------------------------------------------------------------------100
|
#------------------------------------------------------------------------------------------------100
|
||||||
|
|
||||||
function compute_paramsChange!(kfn::kfn_1, modelError, outputError)
|
function compute_paramsChange!(kfn::kfn_1, modelError, outputError)
|
||||||
modelError = reshape(modelError, (1,1,1,:)) # (1,1,1,batch)
|
# modelError = reshape(modelError, (1,1,1,:)) # (1,1,1,batch)
|
||||||
|
modelError = reshape(modelError, (1,1,:, size(modelError, 2)))
|
||||||
|
modelError = sum(modelError, dims=3)
|
||||||
|
|
||||||
lifComputeParamsChange!(kfn.timeStep,
|
lifComputeParamsChange!(kfn.timeStep,
|
||||||
kfn.lif_phi,
|
kfn.lif_phi,
|
||||||
kfn.lif_epsilonRec,
|
kfn.lif_epsilonRec,
|
||||||
@@ -92,6 +95,23 @@ function lifComputeParamsChange!( timeStep::CuArray,
|
|||||||
#TODO frequency regulator
|
#TODO frequency regulator
|
||||||
wRecChange .+= 0.0001 .* ((firingTargetFrequency - (firingCounter./timeStep)) .* timeStep) .*
|
wRecChange .+= 0.0001 .* ((firingTargetFrequency - (firingCounter./timeStep)) .* timeStep) .*
|
||||||
eta .* eRec
|
eta .* eRec
|
||||||
|
|
||||||
|
# if sum(timeStep) == 785
|
||||||
|
# epsilonRec_cpu = epsilonRec |> cpu
|
||||||
|
# println("modelError ", modelError)
|
||||||
|
# println("")
|
||||||
|
# wchange = (-eta .* nError .* eRec) |> cpu
|
||||||
|
# println("wchange 5 1 ", wchange[:,:,5,1])
|
||||||
|
# println("")
|
||||||
|
# println("wchange 5 2 ", wchange[:,:,5,2])
|
||||||
|
# println("")
|
||||||
|
# println("epsilonRec 5 1 ", epsilonRec_cpu[:,:,5,1])
|
||||||
|
# println("")
|
||||||
|
# println("epsilonRec 5 2 ", epsilonRec_cpu[:,:,5,2])
|
||||||
|
# println("")
|
||||||
|
# error("DEBUG lifComputeParamsChange!")
|
||||||
|
# end
|
||||||
|
|
||||||
# reset epsilonRec
|
# reset epsilonRec
|
||||||
epsilonRec .= 0
|
epsilonRec .= 0
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user