124 lines
1.2 KiB
Julia
124 lines
1.2 KiB
Julia
module type
|
|
|
|
# export
|
|
|
|
using CUDA, Random
|
|
|
|
#------------------------------------------------------------------------------------------------100
|
|
|
|
abstract type Ironpen end
|
|
abstract type knowledgeFn <: Ironpen end
|
|
|
|
rng = MersenneTwister(1234)
|
|
#------------------------------------------------------------------------------------------------100
|
|
|
|
|
|
|
|
Base.@kwdef mutable struct kfn <: knowledgeFn
|
|
params::Dict = Dict() # store params of knowledgeFn itself for later use
|
|
timeStep::AbstractArray = [0]
|
|
refractory::Union{AbstractArray, Nothing} = nothing
|
|
z_i_t1::Union{AbstractArray, Nothing} = nothing # 2D activation matrix
|
|
z_i_t::Union{AbstractArray, Nothing} = nothing
|
|
z_t::Union{AbstractArray, Nothing} = nothing
|
|
z_t1::Union{AbstractArray, Nothing} = nothing
|
|
end
|
|
|
|
function kfn(kfnParams::Dict)
|
|
kfn = kfn()
|
|
kfn.kfnParams = kfnParams
|
|
kfn.knowledgeFnName = kfn.kfnParams[:knowledgeFnName]
|
|
|
|
if kfn.kfnParams[:computeNeuronNumber] < kfn.kfnParams[:totalInputPort]
|
|
throw(error("number of compute neuron must be greater than input neuron"))
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
error("debug end")
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end # module |