Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoming0625 committed May 5, 2022
1 parent 8060516 commit 4444d88
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion brainpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

__version__ = "2.1.9"
__version__ = "2.1.10"


try:
Expand Down
16 changes: 8 additions & 8 deletions brainpy/dyn/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def get_delay_data(
self,
name: str,
delay_step: Union[int, bm.JaxArray, jnp.DeviceArray],
indices: Union[int, bm.JaxArray, jnp.DeviceArray] = None,
*indices: Union[int, bm.JaxArray, jnp.DeviceArray],
):
"""Get delay data according to the provided delay steps.
Expand All @@ -192,18 +192,18 @@ def get_delay_data(
"""
if name in self.global_delay_vars:
if isinstance(delay_step, int):
return self.global_delay_vars[name](delay_step, indices)
return self.global_delay_vars[name](delay_step, *indices)
else:
if indices is None:
indices = jnp.arange(delay_step.size)
return self.global_delay_vars[name](delay_step, indices)
if len(indices) == 0:
indices = (jnp.arange(delay_step.size), )
return self.global_delay_vars[name](delay_step, *indices)
elif name in self.local_delay_vars:
if isinstance(delay_step, int):
return self.local_delay_vars[name](delay_step)
else:
if indices is None:
indices = jnp.arange(delay_step.size)
return self.local_delay_vars[name](delay_step, indices)
if len(indices) == 0:
indices = (jnp.arange(delay_step.size), )
return self.local_delay_vars[name](delay_step, *indices)
else:
raise ValueError(f'{name} is not defined in delay variables.')

Expand Down
1 change: 0 additions & 1 deletion brainpy/nn/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1478,7 +1478,6 @@ def plot_node_graph(self,
legends = dict() if legends is None else legends
ax.legend(proxie, labels, scatterpoints=1, markerscale=2, loc='best', **legends)
if show:
plt.tight_layout()
plt.show()


Expand Down

0 comments on commit 4444d88

Please sign in to comment.