TensorFlow的tf.random_uniform()函数的用法

tf.random_uniform((6, 6), minval=low,maxval=high,dtype=tf.float32)))

返回6*6的矩阵,产生于low和high之间,产生的值是均匀分布的。

 
  1. import tensorflow as tf

  2. with tf.Session() as sess:

  3. print(sess.run(tf.random_uniform(

  4. (6,6), minval=-0.5,

  5. maxval=0.5, dtype=tf.float32)))

 

 
  1. [[ 0.47818196 -0.0463798 -0.48545432 0.48667777 0.1448754 0.31394303]

  2. [ 0.07446766 0.37638378 0.3001852 -0.1716789 0.03881919 0.14070213]

  3. [ 0.14747012 -0.14895666 -0.35274172 -0.19400203 -0.26068127 0.10212302]

  4. [ 0.29586768 0.16780066 -0.34365273 -0.3228333 0.42329776 0.35237122]

  5. [-0.34602797 -0.46733367 0.46615827 -0.20312655 -0.37987483 0.41316974]

  6. [ 0.39296162 0.32745218 -0.32554448 -0.14309132 -0.16133463 0.40627968]]

https://blog.csdn.net/sunshunli/article/details/80186884?utm_source=copy

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值