You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just wonder whether the L2 regularization for gradient should also be considered in the third question of NetworkVisualization-TensorFlow. Otherwise, the variable Xi remains unused. The computed gradient should be like dx[0] - 2 * l2_reg * Xi instead of dx[0]
The text was updated successfully, but these errors were encountered:
That's correct. The regularization should have a share of the gradient, and that's what's actually happening here. TensorFlow calculates this automatically, hence the name of 'auto diff.' Correct me if I'm looking at the wrong piece of code:
loss=model.classifier[0, target_y] -l2_reg*tf.nn.l2_loss(model.image) # scalar lossgrad=tf.gradients(loss, model.image) # gradient of loss with respect to model.image, samedx=sess.run(grad, feed_dict={model.image: X})
X+=dx[0] *learning_rate
hello,
I just wonder whether the L2 regularization for gradient should also be considered in the third question of
NetworkVisualization-TensorFlow
. Otherwise, the variableXi
remains unused. The computed gradient should be likedx[0] - 2 * l2_reg * Xi
instead ofdx[0]
The text was updated successfully, but these errors were encountered: