tensorflow 如何生成各种随机数,不要限制在框架内!
X = tf.placeholder(tf.int32,shape=(None,None))
int1 = sess.run(X,feed_dict={X:[random.choices([1,2,3,4,5,6,7,8],k=5) for _ in range(10)]})
int2 = sess.run(tf.constant([random.choices([1,2,3,4,5,6,7,8],k=5) for _ in range(10)]))
int3 = sess.run(tf.convert_to_tensor([random.choices([1,2,3,4,5,6,7,8],k=5) for _ in range(10)]))
float1= sess.run(tf.random_normal([2, 3], mean=-1, stddev=4))
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:TensorFlow 产生任意随机数 - Python技术站