Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoming0625 committed Dec 13, 2021
1 parent dcf90b5 commit f6a8875
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ publishment.md
#experimental/
.vscode

BrainPyExamples
BrainModels
docs/apis/auto
book/
docs/examples
docs/apis/jaxsetting.rst
Expand Down
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__ = "1.1.5"
__version__ = "1.1.7"


# "base" module
Expand Down
14 changes: 10 additions & 4 deletions brainpy/math/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,22 @@
def numpy_array(array):
global jarray
if jarray is None:
from jax.numpy import ndarray as jarray
try:
from jax.numpy import ndarray as jarray
except (ModuleNotFoundError, ImportError):
pass
global JaxArray
if JaxArray is None:
from brainpy.math.jax.jaxarray import JaxArray
try:
from brainpy.math.jax.jaxarray import JaxArray
except (ModuleNotFoundError, ImportError):
pass

if isinstance(array, np.ndarray):
array = array
elif JaxArray and isinstance(array, JaxArray):
elif (JaxArray is not None) and isinstance(array, JaxArray):
array = array.numpy()
elif jarray and isinstance(array, jarray):
elif (jarray is not None) and isinstance(array, jarray):
array = np.asarray(array)
else:
raise ValueError
Expand Down

0 comments on commit f6a8875

Please sign in to comment.