Open
Description
- Check for duplicate issues.
- Provide a complete example of how to reproduce the bug, wrapped in triple backticks like this:
- If applicable, include full error messages/tracebacks.
I am trying to implement the function in Brainpy: x / (1.0 - bm.exp(-x))
. When x->0
, the function has a theoretical limit of 1.0
, but if we directly set x=0
, the function will output NaN
.
In Numpy, this can be handled by: np.divide(x, 1.0-np.exp(-x), out=np.ones_like(x), where=np.abs(x)>=1.0e-6)
.
However, in Brainpy, the similar expression does not work: bm.divide(x, 1.0-bm.exp(-x), out=bm.ones_like(x), where=bm.abs(x)>=1.0e-6)
. The error message is: TypeError: true_divide() got an unexpected keyword argument 'where'
.
How can we deal with situations like this in Brainpy?