Skip to content

Commit daf5002

Browse files
authored
fix delay update bug (#281
fix delay update bug
2 parents 87c0b86 + 7a3219a commit daf5002

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

brainpy/math/delayvars.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,8 @@ def update(self, value: Union[float, int, bool, JaxArray, jnp.DeviceArray]):
445445
The value of the latest data, used to update this delay variable.
446446
"""
447447
if self.update_method == ROTATION_UPDATING:
448+
self.idx.value = stop_gradient((self.idx - 1) % self.num_delay_step)
448449
self.data[self.idx[0]] = value
449-
self.idx.value = stop_gradient((self.idx + 1) % self.num_delay_step)
450450

451451
elif self.update_method == CONCAT_UPDATING:
452452
if self.num_delay_step >= 2:

0 commit comments

Comments
 (0)