tensorflow-cpu 2.8.0
python=3.10
@tf.function
def custom_sigmoid(x):
res = 10 / (1 + tf.math.exp(-x))
return tf.where(res <= 600, res, 600)
对应:
c
u
s
t
o
m
_
s
i
g
m
o
i
d
=
10
1
+
exp
(
−
x
)
custom\_sigmoid = \cfrac{10}{1 + \exp{(-x)}}
custom_sigmoid=1+exp(−x)10
参考:
https://tensorflow.google.cn/versions/r2.8/api_docs/python/tf
https://tensorflow.google.cn/versions/r2.8/api_docs/python/tf/where
https://tensorflow.google.cn/versions/r2.8/api_docs/python/tf/math/exp
https://blog.csdn.net/bjay/article/details/115494010