trainee = False
Here the value of the variable will be constant during training. The optimizer will not consider this variable for training, without updating the gradient.
stop_gradient
op , ; . trinable=False, .
stop_gradient ops; op , .
y1 = tf.stop_gradient(W1x+b1)
y2 = W2y1+b2
cost = cost_function(y2, y)
train_op_w2_b2 = tf.train.MomentumOptimizer(0.001, 0.9).minimize(cost)
W1 = tf.get_variable('w1', trainable=False)
y1 = W1x+b1
y2 = W2y1+b2
cost = cost_function(y2, y)
train_op = tf.train.MomentumOptimizer(0.001, 0.9).minimize(cost)