'Construct a function using the current keras backend that, when given a batch
of inputs, simply processes them forward and returns the output
This is as opposed to model.compile(), which takes a loss function
and training method.
c.f. https://github.com/fchollet/keras/issues/1426'

def _model_forward(self):

    if self.model.uses_learning_phase:
        forward_function = K.function([self.model.input, K.learning_phase()], [self.model.output])
        return (lambda inpt: forward_function([inpt, 0])[0])
    else:
        forward_function = K.function([self.model.input], [self.model.output])
        return (lambda inpt: forward_function([inpt])[0])
