MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / update_grad

Method update_grad

tensorpack/tfutils/optimizer.py:204–208  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

202 update_slot_op = tf.group(update_counter, *ops, name='update_slot')
203
204 def update_grad():
205 update_op = self._opt.apply_gradients(slots_and_vars)
206 with tf.control_dependencies([update_op]):
207 clear_ops = [tfv1.assign(s, tf.zeros_like(s)) for s in slots]
208 return tf.group(*clear_ops, name='update_grad')
209
210 pred = tf.equal(tfv1.mod(counter, self._niter), 0)
211 with tf.control_dependencies([update_slot_op]):

Callers

nothing calls this directly

Calls 2

groupMethod · 0.80
apply_gradientsMethod · 0.45

Tested by

no test coverage detected