Skip to content

Commit d2b2a15

Browse files
committed
monitors and inputs compatibility
1 parent 97704ab commit d2b2a15

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

brainpy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
__version__ = "2.3.2"
3+
__version__ = "2.3.3"
44

55

66
# fundamental supporting modules

brainpy/_src/dyn/runners.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ def __init__(
361361
warnings.warn('`fun_inputs` is deprecated since version 2.3.1. '
362362
'Define `fun_inputs` as `inputs` instead.',
363363
UserWarning)
364+
self._fun_inputs = fun_inputs
364365
if callable(inputs):
365366
self._inputs = inputs
366367
else:
@@ -551,6 +552,8 @@ def _step_func_monitor(self, shared):
551552
return res
552553

553554
def _step_func_input(self, shared):
555+
if self._fun_inputs is not None:
556+
self._fun_inputs(shared)
554557
if callable(self._inputs):
555558
self._inputs(shared)
556559
else:

brainpy/_src/math/ndarray.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,8 @@ def _check_input_array(array):
9393

9494

9595
def _return(a):
96-
if _return_bp_array:
97-
if isinstance(a, jax.Array):
98-
if a.ndim > 1:
99-
return Array(a)
96+
if _return_bp_array and isinstance(a, jax.Array) and a.ndim > 1:
97+
return Array(a)
10098
return a
10199

102100

0 commit comments

Comments
 (0)