02-3 Linear Regression : feed from variable
■ Place hold 사용법을 익힌다. (파이썬 변수를 feed 처리함) ▶Place hold 사용 - 변수 대입x_train = [1,2,3,4]y_train = [0,-1,-2,-3]- place hold 에 feed_dict로 연결할 변수 생성 curr_W,curr_b,curr_loss = sess.run([W,b,loss],{x:x_train,y:y_train})-세션을 실행할 때 place hold에 변수를 대입한다.이때 사용되는 것이 feed_dict이다 123456789101112131415161718192021222324252627282930313233import tensorflow as tf W=tf.Variable([.3],tf.float32)b=tf.Variable([-.3],tf...
더보기
02-2 Linear Regression : feed
■ Place hold 를 입력으로 사용하여 간단한 Linear regression 구현 ▶Place hold 사용 - 상수 대입X = tf.placeholder(tf.float32, shape=[None])Y = tf.placeholder(tf.float32, shape=[None])- rank = 1 이고 type이 tf.float32 인 place hold 를 생성한다.- None은 해당 축의 원소 갯수를 임의로 선정한다는 의미이다. sess.run([cost,W,b,train],feed_dict={X:[1,2,3],Y:[1,2,3]})- 세션을 실행할 때 place hold에 변수를 대입한다.-이때 사용되는 것이 feed_dict 이다. 123456789101112131415161718192021..
더보기