fix
This commit is contained in:
@@ -22,16 +22,21 @@ function (kfn::kfn_1)(input::AbstractArray)
|
|||||||
kfn.lif_wRecChange .= 0
|
kfn.lif_wRecChange .= 0
|
||||||
kfn.lif_epsilonRec .= 0
|
kfn.lif_epsilonRec .= 0
|
||||||
kfn.lif_firingCounter .= 0
|
kfn.lif_firingCounter .= 0
|
||||||
|
kfn.lif_refractoryCounter .= 0
|
||||||
|
kfn.lif_zt .= 0
|
||||||
|
|
||||||
kfn.alif_vt .= 0
|
kfn.alif_vt .= 0
|
||||||
kfn.alif_epsilonRec .= 0
|
kfn.alif_epsilonRec .= 0
|
||||||
kfn.alif_epsilonRecA .= 0
|
kfn.alif_epsilonRecA .= 0
|
||||||
kfn.alif_wRecChange .= 0
|
kfn.alif_wRecChange .= 0
|
||||||
kfn.alif_firingCounter .= 0
|
kfn.alif_firingCounter .= 0
|
||||||
|
kfn.alif_refractoryCounter .= 0
|
||||||
|
kfn.alif_zt .= 0
|
||||||
|
|
||||||
kfn.on_vt .= 0
|
kfn.on_vt .= 0
|
||||||
kfn.on_epsilonRec .= 0
|
kfn.on_epsilonRec .= 0
|
||||||
kfn.on_wOutChange .= 0
|
kfn.on_wOutChange .= 0
|
||||||
|
kfn.on_refractoryCounter .= 0
|
||||||
|
|
||||||
kfn.learningStage = [2]
|
kfn.learningStage = [2]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ function lifComputeParamsChange!( timeStep::CuArray,
|
|||||||
wRecChange .+= (-eta .* nError .* eRec)
|
wRecChange .+= (-eta .* nError .* eRec)
|
||||||
|
|
||||||
# frequency regulator
|
# frequency regulator
|
||||||
wRecChange .+= 0.0001 .* ((firingTargetFrequency - (firingCounter./timeStep)) .* timeStep) .*
|
wRecChange .+= 0.001 .* ((firingTargetFrequency - (firingCounter./timeStep)) ./ timeStep) .*
|
||||||
eta .* eRec
|
eta .* eRec
|
||||||
|
|
||||||
# if sum(timeStep) == 785
|
# if sum(timeStep) == 785
|
||||||
@@ -149,7 +149,7 @@ function alifComputeParamsChange!( timeStep::CuArray,
|
|||||||
wRecChange .+= (-eta .* nError .* eRec)
|
wRecChange .+= (-eta .* nError .* eRec)
|
||||||
|
|
||||||
# frequency regulator
|
# frequency regulator
|
||||||
wRecChange .+= 0.0001 .* ((firingTargetFrequency - (firingCounter./timeStep)) .* timeStep) .*
|
wRecChange .+= 0.001 .* ((firingTargetFrequency - (firingCounter./timeStep)) ./ timeStep) .*
|
||||||
eta .* eRec
|
eta .* eRec
|
||||||
|
|
||||||
# reset epsilonRec
|
# reset epsilonRec
|
||||||
@@ -171,7 +171,7 @@ function onComputeParamsChange!(phi::CuArray,
|
|||||||
|
|
||||||
eRec .= phi .* epsilonRec
|
eRec .= phi .* epsilonRec
|
||||||
nError .= reshape(outputError, (1, 1, :, size(outputError, 2))) .* arrayProjection4d
|
nError .= reshape(outputError, (1, 1, :, size(outputError, 2))) .* arrayProjection4d
|
||||||
wOutChange .+= (-eta .* nError .* eRec)
|
wOutChange .+= (-eta .* nError .* eRec) #BUG why wOutChange not increase every timestep that madel get wrong answer?
|
||||||
|
|
||||||
# reset epsilonRec
|
# reset epsilonRec
|
||||||
epsilonRec .= 0
|
epsilonRec .= 0
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ function kfn_1(params::Dict; device=cpu)
|
|||||||
for slice in eachslice(w, dims=3)
|
for slice in eachslice(w, dims=3)
|
||||||
pool = shuffle!([1:row*col...])[1:synapticConnection]
|
pool = shuffle!([1:row*col...])[1:synapticConnection]
|
||||||
for i in pool
|
for i in pool
|
||||||
slice[i] = randn()/10 # assign weight to synaptic connection
|
slice[i] = randn()/10 # assign weight to synaptic connection, start small
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# project 3D w into 4D kfn.lif_wRec (row, col, n, batch)
|
# project 3D w into 4D kfn.lif_wRec (row, col, n, batch)
|
||||||
|
|||||||
Reference in New Issue
Block a user