Exemple #1
0
 def setUp(self):
     self._metric_function = Mock(return_value='test')
     self._metric = BatchLambda('test', self._metric_function)
     self._states = [{
         torchbearer.Y_TRUE: Variable(torch.FloatTensor([1])),
         torchbearer.Y_PRED: Variable(torch.FloatTensor([2]))
     }, {
         torchbearer.Y_TRUE: Variable(torch.FloatTensor([3])),
         torchbearer.Y_PRED: Variable(torch.FloatTensor([4]))
     }, {
         torchbearer.Y_TRUE: Variable(torch.FloatTensor([5])),
         torchbearer.Y_PRED: Variable(torch.FloatTensor([6]))
     }]
 def build(self):
     if on_epoch:
         return EpochLambda(name, metric_function)
     else:
         return BatchLambda(name, metric_function)
Exemple #3
0
 def decorator(metric_function):
     if on_epoch:
         return EpochLambda(name, metric_function)
     else:
         return BatchLambda(name, metric_function)