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

Method _mapper

tensorpack/tfutils/gradproc.py:172–181  ·  view source on GitHub ↗
(self, grad, var)

Source from the content-addressed store, hash-verified

170 self._coll = collections
171
172 def _mapper(self, grad, var):
173 name = var.op.name
174 if re.match('tower[0-9]+/', name):
175 # replicated training, var may come from different towers
176 return grad
177 if name not in SummaryGradient._summaried_gradient:
178 SummaryGradient._summaried_gradient.add(name)
179 tfv1.summary.histogram(name + '-grad', grad, collections=self._coll)
180 add_moving_summary(rms(grad, name=name + '/rms'))
181 return grad
182
183
184class PrintGradient(MapGradient):

Callers

nothing calls this directly

Calls 3

add_moving_summaryFunction · 0.85
rmsFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected