tf.random.truncated_normal()-截断正态分布
一、总结
一句话总结:
sigmoid激活函数,用截断的正态分布更好,因为这样就不会有两侧的梯度消失的情况
二、tf.random.truncated
转自或参考:tf.random.truncated
https://blog.csdn.net/qq_39894692/article/details/101635922
来自https://tensorflow.google.cn/versions/r1.15/api_docs/python/tf/random/truncated_normal?hl=en
Outputs random values from a truncated normal distribution.
此函数别名有:
tf.compat.v1.random.truncated_normal
tf.compat.v1.truncated_normal
tf.compat.v2.random.truncated_normal
tf.truncated_normal
tf.random.truncated_normal(
shape,
mean=0.0,
stddev=1.0,
dtype=tf.dtypes.float32,
seed=None,
name=None
)
Args:
shape
: A 1-D integer Tensor or Python array. The shape of the output tensor.mean
: A 0-D Tensor or Python value of typedtype
. The mean of the truncated normal distribution.均值默认为0stddev
: A 0-D Tensor or Python value of typedtype
. The standard deviation of the normal distribution, before truncation.截断前正态分布的标准偏差,默认为1.0dtype
: The type of the output.seed
: A Python integer. Used to create a random seed for the distribution. Seetf.compat.v1.set_random_seed
for behavior.name
: A name for the operation (optional).