BaseLoss.py 494 Bytes
Newer Older
Tiago de Freitas Pereira's avatar
Scratch  
Tiago de Freitas Pereira committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# @author: Tiago de Freitas Pereira <tiago.pereira@idiap.ch>
# @date: Tue 09 Aug 2016 16:38 CEST

import logging
logger = logging.getLogger("bob.learn.tensorflow")


class BaseLoss(object):
    """
    Base loss function.

    One exam
    """

17
    def __init__(self, loss, operation):
Tiago de Freitas Pereira's avatar
Scratch  
Tiago de Freitas Pereira committed
18
        self.loss = loss
19
        self.operation = operation
Tiago de Freitas Pereira's avatar
Scratch  
Tiago de Freitas Pereira committed
20

21 22
    def __call__(self, graph, label):
        return self.operation(self.loss(graph, label))