When I use the following custom metric (keras-style):
from sklearn.metrics import classification_report, f1_score from ten
Add this line after importing tensorflow:
tf.compat.v1.disable_eager_execution()