From ea004f5f456930f53d069d3e6a56f0a4b7a75828 Mon Sep 17 00:00:00 2001 From: ton Date: Thu, 6 Jul 2023 12:02:12 +0700 Subject: [PATCH] add Random --- Manifest.toml | 8 ++++---- Project.toml | 1 + src/IronpenGPU.jl | 2 +- src/type.jl | 44 ++++++++++++++++++++++++++++++++++++++++---- 4 files changed, 46 insertions(+), 9 deletions(-) diff --git a/Manifest.toml b/Manifest.toml index 938a2b2..03e715a 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -1,8 +1,8 @@ # 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" -project_hash = "d86d570e6c4d2d0ecbcd4606884947cccd9fe0ff" +project_hash = "bf29b9b6c22b1a96a3e10687abec46c3de1b7715" [[deps.AbstractFFTs]] deps = ["LinearAlgebra"] @@ -142,7 +142,7 @@ weakdeps = ["Dates", "LinearAlgebra"] [[deps.CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" -version = "1.0.2+0" +version = "1.0.5+0" [[deps.CompositionsBase]] git-tree-sha1 = "802bb88cd69dfd1509f6670416bd4434015693ad" @@ -530,7 +530,7 @@ version = "1.6.0" [[deps.Pkg]] 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" -version = "1.9.0" +version = "1.9.2" [[deps.PrecompileTools]] deps = ["Preferences"] diff --git a/Project.toml b/Project.toml index a7cfb10..0978590 100644 --- a/Project.toml +++ b/Project.toml @@ -6,3 +6,4 @@ version = "0.1.0" [deps] CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c" +Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" diff --git a/src/IronpenGPU.jl b/src/IronpenGPU.jl index 393a2a6..5cd0c36 100644 --- a/src/IronpenGPU.jl +++ b/src/IronpenGPU.jl @@ -7,7 +7,7 @@ module IronpenGPU 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) include("snnUtils.jl") diff --git a/src/type.jl b/src/type.jl index bf5c2c1..2bb928e 100644 --- a/src/type.jl +++ b/src/type.jl @@ -2,7 +2,7 @@ module type # export -using CUDA +using CUDA, Random #------------------------------------------------------------------------------------------------100 @@ -18,10 +18,48 @@ 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_t2::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 @@ -80,8 +118,6 @@ end - -