'Build accuracy, comparing predictions and targets.'

def build(self, predictions, targets, inputs=None):

    self.built = True
    pshape = predictions.get_shape()
    if ((len(pshape) == 1) or ((len(pshape) == 2) and (int(pshape[1]) == 1))):
        self.name = (self.name or 'binary_acc')
        self.tensor = binary_accuracy_op(predictions, targets)
    else:
        self.name = (self.name or 'acc')
        self.tensor = accuracy_op(predictions, targets)
    self.tensor.m_name = self.name
