def test_epoch_accuracy(example_batch): metric = Loss() for _ in range(4): example_batch.loss /= 2 _ = metric.update(example_batch) assert str(metric) == "Loss: 0.0492"
def __init__(self, network, label, mask, weight_decay): super(LossAccuracyWrapper, self).__init__() self.network = network self.loss = Loss(label, mask, weight_decay, network.trainable_params()[0]) self.accuracy = Accuracy(label, mask)
def test_batch_loss(example_batch): metric = Loss() _ = metric.update(example_batch) assert round(metric.get_batch_result(3), 3) == 0.21