Axis parameter in the Keras backend sum In Keras custom loss function, I often see axis parameter is set to -1. 

def custom_loss(y_true, y_pred):
    intersection = K.sum(K.abs(y_true * y_pred), axis=-1)


I always thought that it should be 0, as 0 axis represents the batch. So why is set to -1?
Because y_true and y_pred have shapes (N,). Where N is the number of examples. By setting the axis to -1 you are calculating the sum over the last dimension, which happens to be over N (which is the batch)