tf.random_normal_initializer

简介:
Help on class RandomNormal in module tensorflow.python.ops.init_ops:

函数原型:tf.random_normal_initializer(mean=0.0, stddev=1.0, seed=None, dtype=tf.float32)

返回一个生成具有正态分布的张量的初始化器。

参数:

  • mean:python标量或标量tensor,产生的随机值的平均值。

  • stddev:一个python标量或一个标量tensor,标准偏差的随机值生成。

  • seed:一个Python整数。 用于创建随机seed有关行为,请参阅官网API:set_random_seed。

  • dtype:数据类型, 只支持浮点类型。

函数返回:产生具有正态分布的张量的初始化器。

class RandomNormal(Initializer)
 |  Initializer that generates tensors with a normal distribution.
 |  
 |  Args:
 |    mean: a python scalar or a scalar tensor. Mean of the random values
 |      to generate.
 |    stddev: a python scalar or a scalar tensor. Standard deviation of the
 |      random values to generate.
 |    seed: A Python integer. Used to create random seeds. See
 |      @{tf.set_random_seed}
 |      for behavior.
 |    dtype: The data type. Only floating point types are supported.
 |  
 |  Method resolution order:
 |      RandomNormal
 |      Initializer
 |      builtins.object
 |  
 |  Methods defined here:
 |  
 |  __call__(self, shape, dtype=None, partition_info=None)
 |      Call self as a function.
 |  
 |  __init__(self, mean=0.0, stddev=1.0, seed=None, dtype=tf.float32)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |  
 |  get_config(self)
 |      Returns the configuration of the initializer as a JSON-serializable dict.
 |      
 |      Returns:
 |        A JSON-serializable Python dict.
 |  
 |  ----------------------------------------------------------------------
 |  Class methods inherited from Initializer:
 |  
 |  from_config(config) from builtins.type
 |      Instantiates an initializer from a configuration dictionary.
 |      
 |      Example:
 |      
 |      ```python
 |      initializer = RandomUniform(-1, 1)
 |      config = initializer.get_config()
 |      initializer = RandomUniform.from_config(config)
 |      ```
 |      
 |      Args:
 |        config: A Python dictionary.
 |          It will typically be the output of `get_config`.
 |      
 |      Returns:
 |        An Initializer instance.
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from Initializer:
 |  
 |  __dict__
 |      dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |      list of weak references to the object (if defined)
目录
相关文章
|
10月前
|
数据格式
详解torch.size
详解torch.size
111 0
详解torch.size
|
11月前
Expected more than 1 value per channel when training, got input size torch.Size
因为模型中用了batchnomolization,训练中用batch训练的时候当前batch恰好只含一个sample,而由于BatchNorm操作需要多于一个数据计算平均值,因此造成该错误。
693 0
|
PyTorch 算法框架/工具
pytorch报错 RuntimeError: The size of tensor a (25) must match the size of tensor b (50) at non-singleton dimension 1 怎么解决?
这个错误提示表明,在进行某个操作时,张量a和b在第1个非单例维(即除了1以外的维度)上的大小不一致。例如,如果a是一个形状为(5, 5)的张量,而b是一个形状为(5, 10)的张量,则在第二个维度上的大小不匹配。
3053 0
(2)tf.Variable中trainable作用
如果为True,则会默认将变量添加到图形集合GraphKeys.TRAINABLE_VARIABLES中。此集合用于优化器Optimizer类优化的的默认变量列表,如果为False则在训练时不会更新该值。
110 0
成功解决ValueError: Cannot feed value of shape (1, 10, 4) for Tensor Placeholder:0 , which has shape
成功解决ValueError: Cannot feed value of shape (1, 10, 4) for Tensor Placeholder:0 , which has shape
|
TensorFlow 算法框架/工具
TensorFlow教程(6) tf.Variable() 和tf.get_variable()
TensorFlow教程(6) tf.Variable() 和tf.get_variable()
152 0
|
定位技术 内存技术
TF 卡是什么
TF 卡是什么
398 0
成功解决linear_model\stochastic_gradient.py:128: FutureWarning: max_iter and tol parameters have been ad
成功解决linear_model\stochastic_gradient.py:128: FutureWarning: max_iter and tol parameters have been ad
|
Python 算法框架/工具 TensorFlow