add Random

This commit is contained in:
ton
2023-07-06 12:02:12 +07:00
parent 89e0e6aae9
commit ea004f5f45
4 changed files with 46 additions and 9 deletions

View File

@@ -1,8 +1,8 @@
# This file is machine-generated - editing it directly is not advised # This file is machine-generated - editing it directly is not advised
julia_version = "1.9.1" julia_version = "1.9.2"
manifest_format = "2.0" manifest_format = "2.0"
project_hash = "d86d570e6c4d2d0ecbcd4606884947cccd9fe0ff" project_hash = "bf29b9b6c22b1a96a3e10687abec46c3de1b7715"
[[deps.AbstractFFTs]] [[deps.AbstractFFTs]]
deps = ["LinearAlgebra"] deps = ["LinearAlgebra"]
@@ -142,7 +142,7 @@ weakdeps = ["Dates", "LinearAlgebra"]
[[deps.CompilerSupportLibraries_jll]] [[deps.CompilerSupportLibraries_jll]]
deps = ["Artifacts", "Libdl"] deps = ["Artifacts", "Libdl"]
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
version = "1.0.2+0" version = "1.0.5+0"
[[deps.CompositionsBase]] [[deps.CompositionsBase]]
git-tree-sha1 = "802bb88cd69dfd1509f6670416bd4434015693ad" git-tree-sha1 = "802bb88cd69dfd1509f6670416bd4434015693ad"
@@ -530,7 +530,7 @@ version = "1.6.0"
[[deps.Pkg]] [[deps.Pkg]]
deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
version = "1.9.0" version = "1.9.2"
[[deps.PrecompileTools]] [[deps.PrecompileTools]]
deps = ["Preferences"] deps = ["Preferences"]

View File

@@ -6,3 +6,4 @@ version = "0.1.0"
[deps] [deps]
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c" Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

View File

@@ -7,7 +7,7 @@ module IronpenGPU
files and each file can only depend on the file included before it. files and each file can only depend on the file included before it.
""" """
include("types.jl") include("type.jl")
using .types # bring model into this module namespace (this module is a parent module) using .types # bring model into this module namespace (this module is a parent module)
include("snnUtils.jl") include("snnUtils.jl")

View File

@@ -2,7 +2,7 @@ module type
# export # export
using CUDA using CUDA, Random
#------------------------------------------------------------------------------------------------100 #------------------------------------------------------------------------------------------------100
@@ -18,10 +18,48 @@ Base.@kwdef mutable struct kfn <: knowledgeFn
params::Dict = Dict() # store params of knowledgeFn itself for later use params::Dict = Dict() # store params of knowledgeFn itself for later use
timeStep::AbstractArray = [0] timeStep::AbstractArray = [0]
refractory::Union{AbstractArray, Nothing} = nothing refractory::Union{AbstractArray, Nothing} = nothing
z_i_t1::Union{AbstractArray, Nothing} = nothing # 2D activation matrix
z_i_t::Union{AbstractArray, Nothing} = nothing z_i_t::Union{AbstractArray, Nothing} = nothing
z_t2::Union{AbstractArray, Nothing} = nothing z_t::Union{AbstractArray, Nothing} = nothing
z_t1::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
@@ -80,8 +118,6 @@ end