"텐서플로우 random uniform()"의 두 판 사이의 차이

 
1번째 줄: 1번째 줄:
{{DISPLAYTITLE:TensorFlow random_uniform()}}
{{DISPLAYTITLE:텐서플로우 random_uniform()}}
==개요==
==개요==
;TensorFlow random_uniform()
;TensorFlow random_uniform()

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 }}