텐서플로우 random_uniform()

Jmnote (토론 | 기여)님의 2019년 9월 15일 (일) 22:36 판
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요[ | ]

TensorFlow random_uniform()
텐서플로우 random_uniform()
  • 0~1 사이의 균등확률분포 값을 생성해주는 함수
  • 원하는 shape 대로 만들어줌
[1]
import tensorflow as tf

a = tf.random_uniform([1],seed=42)

sess = tf.Session()
sess.run( tf.global_variables_initializer() )

for i in range(5):
    print( "a=", sess.run(a) )
   
# a= [ 0.95227146]
# a= [ 0.89607787]
# a= [ 0.70954347]
# a= [ 0.18126988]
# a= [ 0.06347668]
[2,3]
import tensorflow as tf

a = tf.random_uniform([2,3],seed=42)

sess = tf.Session()
sess.run( tf.global_variables_initializer() )

for i in range(3):
    print( "a=", sess.run(a) )
# a= [[ 0.95227146  0.67740774  0.79531825]
#  [ 0.75578177  0.47595561  0.63101482]]
# a= [[ 0.15116918  0.99881423  0.43071377]
#  [ 0.92499077  0.41770971  0.94794309]]
# a= [[ 0.94573236  0.09348297  0.51999891]
#  [ 0.44088244  0.82003701  0.35246098]]

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}