I have this custom loss function which has a lot of if else statements and uses the network input(i.e., X_train) and the network output( i.e., y_pred) to calculate loss. Because