Based on the posted code it looks like the model is expected to output and a probability for a binary classification, i.e. a sigmoid is used as the last non-linearity.
Is this also the case for your model?
Also, could you check the shapes of your output as well as the target tensor y_true to make sure that no unwanted broadcasting is happening?