Skip to content

Commit

Permalink
corrected LPU.py for cases when no synapse is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
yiyin committed Dec 17, 2015
1 parent c459b7c commit fe6c495
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions neurokernel/LPU/LPU.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,11 @@ def __init__(self, dt, n_dict, s_dict, input_file=None, output_file=None,
n['num_dendrites_cond'] = Counter(n['cond_post'])
n['num_dendrites_I'] = Counter(n['I_post'])

s_id = np.concatenate([s['id'] for _, s in self.s_list]).astype(np.int32)
if len(self.s_list) > 0:
s_id = np.concatenate([s['id'] for _, s in self.s_list]).astype(np.int32)
else:
s_id = np.empty(0, dtype = np.int32)

s_order = np.arange(self.total_synapses)[s_id]
idx = np.where(cond_post >= self.nid_max)[0]
cond_post_syn = s_order[cond_post[idx] - self.nid_max]
Expand Down Expand Up @@ -775,7 +779,7 @@ def _initialize_gpu_ds(self):
"""

self.synapse_state = garray.zeros(
int(self.total_synapses) + len(self.input_neuron_list),
max(int(self.total_synapses) + len(self.input_neuron_list), 1),
np.float64)

if self.total_num_gpot_neurons > 0:
Expand Down

0 comments on commit fe6c495

Please sign in to comment.