How to compute f1 in TensorFlow I have a code that computes the accuracy, but now I would like to compute the F1 score.
accuracy_1 = tf.reduce_mean(tf.cast(tf.equal(
    tf.argmax(output_1, axis=-1),
    tf.argmax(y_1, axis=-1)), tf.float32), name=&quot;accuracy_1&quot;)
accuracy_2 = tf.reduce_mean(tf.cast(tf.equal(
    tf.argmax(output_2, axis=-1),
    tf.argmax(y_2, axis=-1)), tf.float32), name=&quot;accuracy_2&quot;)

How can I compute F1 equivalent for the above code? I'm finding it difficult as I am very new to TensorFlow.
TF Addons computes the F1 score and more generally the FBeta Score