def normal(shape=None, mean=0.0, stddev=0.02, dtype=tf.float32, seed=None):
""" Normal.
Initialization with random values from a normal distribution.
Arguments:
shape: List of `int`. A shape to initialize a Tensor (optional).
mean: Same as `dtype`. The mean of the truncated normal distribution.
stddev: Same as `dtype`. The standard deviation of the truncated
normal distribution.
dtype: The tensor data type.
seed: `int`. Used to create a random seed for the distribution.
Returns:
The Initializer, or an initialized `Tensor` if shape is specified.
"""
if shape:
return tf.random_normal(shape, mean=mean, stddev=stddev, seed=seed,
dtype=dtype)
else:
return tf.random_normal_initializer(mean=mean, stddev=stddev,
seed=seed, dtype=dtype)
评论列表
文章目录