MCPcopy Create free account
hub / github.com/twitter/the-algorithm-ml / forward

Method forward

metrics/rce.py:191–202  ·  view source on GitHub ↗

Serves the dual purpose of both computing the metric on the current batch of inputs but also add the batch statistics to the overall accumulating metric state. Input arguments are the exact same as corresponding ``update`` method. The returned output is the exact same as the out

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

189 self.binary_cross_entropy.reset()
190
191 def forward(self, *args, **kwargs):
192 """
193 Serves the dual purpose of both computing the metric on the current batch of inputs but also
194 add the batch statistics to the overall accumulating metric state.
195 Input arguments are the exact same as corresponding ``update`` method.
196 The returned output is the exact same as the output of ``compute``.
197 """
198 self.update(*args, **kwargs)
199 self.batch_metric.update(*args, **kwargs)
200 batch_result = self.batch_metric.compute()
201 self.batch_metric.reset()
202 return batch_result
203
204
205class NRCE(RCE):

Callers

nothing calls this directly

Calls 3

updateMethod · 0.95
computeMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected