tf.random_uniform((6, 6), minval=low,maxval=high,dtype=tf.float32)))
返回6*6的矩阵,产生于low和high之间,产生的值是均匀分布的。
-
import tensorflow as tf
-
with tf.Session() as sess:
-
print(sess.run(tf.random_uniform(
-
(6,6), minval=-0.5,
-
maxval=0.5, dtype=tf.float32)))
-
[[ 0.47818196 -0.0463798 -0.48545432 0.48667777 0.1448754 0.31394303]
-
[ 0.07446766 0.37638378 0.3001852 -0.1716789 0.03881919 0.14070213]
-
[ 0.14747012 -0.14895666 -0.35274172 -0.19400203 -0.26068127 0.10212302]
-
[ 0.29586768 0.16780066 -0.34365273 -0.3228333 0.42329776 0.35237122]
-
[-0.34602797 -0.46733367 0.46615827 -0.20312655 -0.37987483 0.41316974]
-
[ 0.39296162 0.32745218 -0.32554448 -0.14309132 -0.16133463 0.40627968]]