I would like to write a python function as below:
import numpy as np
a = [[-0.17985, 0.178971],[-0.15312,0.226988]]
(lambda x: x if x > 0 else np.exp(x)-1)(a)
Below is python error message:
TypeError Traceback (most recent call last)
<ipython-input-8-78cecdd2fe9f> in <module>
----> 1 (lambda x: x if x > 0 else np.exp(x)-1)(a)
<ipython-input-8-78cecdd2fe9f> in <lambda>(x)
----> 1 (lambda x: x if x > 0 else np.exp(x)-1)(a)
TypeError: '>' not supported between instances of 'list' and 'int'
How do I fix this problem?
For example:
a = [[-0.17985, 0.178971],[-0.15312,0.226988]]
b = f(a)
expected output
b = [[-0.1646, 0.17897],[-0.14197, 0.22699]]