Parameter(W,b) Update - 텐서플로우(tensorflow)
전체코드(Full Code) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 import tensorflow as tf learning_rate = 0.01 x_data = [1, 2, 3, 4, 5] y_data = [1, 2, 3, 4, 5] W = tf.Variable(3.0) b = tf.Variable(1.0) for i in range(100): with tf.GradientTape() as tape: hypo = W * x_data + b cost = tf.reduce_mean(tf.square(hypo - y_data)) W_grad, b_grad = tape.gradient(cost, [W,b]) W.assign_sub(learning_rate ..
2020. 5. 21.