class_docstr: Testing metric functions from tflearn/metrics
code: def test_binary_accuracy(self):
      with tf.Graph().as_default():
          input_data = tf.placeholder(shape=[None, 1], dtype=tf.float32)
          y_true = tf.placeholder(shape=[None, 1], dtype=tf.float32)
          ba = tflearn.metrics.accuracy()
          ba.build(input_data, y_true)
          acc_op = ba.tensor
  
          X = np.array([1, -1, 1, 1, -1, -1]).reshape([-1, 1])
          Y = np.array([1, 0, 1, 0, 0, 1]).reshape([-1, 1])
          with tf.Session() as sess:
              binary_accuracy = sess.run(
                  acc_op, feed_dict={input_data: X, y_true: Y}
              )
              print("binary_accuracy = %s" % binary_accuracy)
          self.assertEqual(acc_op.m_name, "binary_acc")
          self.assertLess(abs(binary_accuracy - 4.0 / 6), 0.0001)
  
file_path: tflearn/tests/test_metrics.py
imports: import tflearn
  import unittest
  import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 1 for calling the TestMetrics obj's underlying member method code with example usage: obj.test_binary_accuracy() without return types