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
113 0
详解torch.size
|
11月前
|
PyTorch 算法框架/工具 开发者
RuntimeError: Can‘t call numpy() on Variable that requires grad. Use var.detach().numpy()
出现这个现象的原因是:待转换类型的PyTorch Tensor变量带有梯度,直接将其转换为numpy数据将破坏计算图,因此numpy拒绝进行数据转换,实际上这是对开发者的一种提醒。如果自己在转换数据时不需要保留梯度信息,可以在变量转换之前添加detach()调用。
130 0
|
PyTorch 算法框架/工具 异构计算
pytorch中的torch.manual_seed()
random.seed(rand_seed)随机数种子,当使用random.seed(rand_seed)设定好种子之后,其中rand_seed可以是任意数字,比如10,那么每次调用生成的随机数将会是同一个。
124 0
(2)tf.Variable中trainable作用
如果为True,则会默认将变量添加到图形集合GraphKeys.TRAINABLE_VARIABLES中。此集合用于优化器Optimizer类优化的的默认变量列表,如果为False则在训练时不会更新该值。
111 0
|
TensorFlow 算法框架/工具
TensorFlow教程(6) tf.Variable() 和tf.get_variable()
TensorFlow教程(6) tf.Variable() 和tf.get_variable()
152 0
|
定位技术 内存技术
TF 卡是什么
TF 卡是什么
398 0
|
PyTorch 算法框架/工具
关于Pytorch中torch.manual_seed()用法
关于Pytorch中torch.manual_seed()用法
|
算法
P, NP, NP-complete, NP-hard问题对比
图片来源于维基百科 左图在假设P≠NP的情况下有效,右图在假设P=NP的情况下有效 在假定P≠NP的情况下, 有 NP问题:可以在多项式时间内被验证的问题。
1502 0
|
Python 算法框架/工具 TensorFlow