tf.keras.activations.tanh 激活函数 示例

import tensorflow as tf

在这里插入图片描述

在这里插入图片描述

a = tf.constant([-3.0, -1.0, 0.0, 1.0, 3.0], dtype=tf.float32)
b = tf.keras.activations.tanh(a)
b.numpy()
array([-0.9950547, -0.7615942,  0.       ,  0.7615942,  0.9950547],
      dtype=float32)

猜你喜欢

转载自blog.csdn.net/weixin_44493841/article/details/121493635