Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
gitmv committed May 4, 2023
1 parent d727610 commit 26941a5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions NetworkBehavior/Basics/Normalization.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from PymoNNto.NetworkCore.Neuron_Group import *
from PymoNNto.NetworkCore.Behavior import *
import numpy as np

Expand Down Expand Up @@ -35,12 +36,12 @@ def normalize_synapse_attr(src_attr, target_attr, target_value, neurons, synapse
def normalize_synapse_attr_efferent(src_attr, target_attr, target_value, neurons, synapse_type):
neurons.temp_weight_sum = neurons.vector()

for s in neurons.efferent_synapses[synapse_type]:
for s in neurons.synapses(efferent, synapse_type):
s.src.temp_weight_sum += np.sum(np.abs(getattr(s, target_attr)), axis=0)

neurons.temp_weight_sum /= target_value

for s in neurons.efferent_synapses[synapse_type]:
for s in neurons.neurons.synapses(efferent, synapse_type):
setattr(s, src_attr, getattr(s, src_attr) / (s.src.temp_weight_sum + (s.src.temp_weight_sum == 0)))

'''
Expand Down
2 changes: 2 additions & 0 deletions NetworkBehavior/Basics/Normalization_Sparse.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from PymoNNto.NetworkCore.Neuron_Group import *
import numpy as np


def normalize_synapse_attr_sparse(src_attr, target_attr, target_value, neurons, synapse_type):

neurons.temp_weight_sum = neurons.vector()
Expand Down
1 change: 1 addition & 0 deletions NetworkBehavior/Basics/Normalization_Tensorflow.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from PymoNNto.NetworkCore.Neuron_Group import *
from PymoNNto.NetworkCore.Behavior import *
import numpy as np
import tensorflow as tf
Expand Down

0 comments on commit 26941a5

Please sign in to comment.