I am trying to use TensorFlow with my deep learning project.
Here I need to implement my gradient update in this formula:

I also implemented this part in Theano, and it came out of the expected answer. But when I try to use TensorFlow MomentumOptimizer , the result is really bad. I do not know what is different between them.
Theano:
def gradient_updates_momentum_L2(cost, params, learning_rate, momentum, weight_cost_strength):
TensorFlow:
l2_loss = tf.add_n([tf.nn.l2_loss(v) for v in tf.trainable_variables()]) cost = cost + WEIGHT_COST_STRENGTH * l2_loss train_op = tf.train.MomentumOptimizer(LEARNING_RATE, MOMENTUM).minimize(cost)
source share