tf.random_uniform( shape, minval=0, maxval=None, dtype=tf.float32, seed=None, name=None )
shape
: A 1-D integer Tensor or Python array. The shape of the output tensor.minval
: A 0-D Tensor or Python value of typedtype
. The lower bound on the range of random values to generate. Defaults to 0.maxval
: A 0-D Tensor or Python value of typedtype
. The upper bound on the range of random values to generate. Defaults to 1 ifdtype
is floating point.dtype
: The type of the output:float16
,float32
,float64
,int32
, orint64
.seed
: A Python integer. Used to create a random seed for the distribution. Seetf.set_random_seed
for behavior.name
: A name for the operation (optional).
实例:tf.random_uniform([3,2],-1,2)
返回3行2列的矩阵,值在-1和2之间,产生的值时均匀分布的。