当前位置:网站首页>random.normal() and random.truncated_normal() in TF

random.normal() and random.truncated_normal() in TF

2022-08-09 23:11:00 phac123

Brief

The tf.random.normal() and tf.random.truncated_normal() methods are commonly used in TF to create Tensors that conform to the normal distribution.
The difference between them is that the latter guarantees the value of randomly generated dataBetween (μ-2σ, μ+2σ), if the generated data exceeds this range, re-generate.
μ: mean, σ: standard deviation

Code

import tensorflow as tfd = tf.random.normal([2,span> 2], mean = 0.5, stddev = 1)print("d: ", d)e = tf.random.truncated_normal([2,span> 2], mean = 0.5, stddev = 1)print("e: ", e)

insert image description here

原网站

版权声明
本文为[phac123]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/221/202208091954321551.html