def calc_loss(prediction, targets): #categorical crossentropy is the best choice for a multi-class softmax output loss = T.mean(objectives.categorical_crossentropy(prediction, targets)) return loss