def hamming_distance_test(self): actuals = tf.constant([1, 1, 0, 0, 1, 0, 1, 0, 0, 1], dtype=tf.int32) predictions = tf.constant([1, 0, 0, 0, 1, 0, 0, 1, 0, 1], dtype=tf.int32) test_result = hamming_distance(actuals, predictions) self.assertAllClose(0.3, test_result, atol=1e-5)
def hamming_distance_test(): actuals = tf.constant([1, 1, 0, 0, 1, 0, 1, 0, 0, 1], dtype=tf.int32) predictions = tf.constant([1, 0, 0, 0, 1, 0, 0, 1, 0, 1], dtype=tf.int32) test_result = hamming_distance(actuals, predictions) np.testing.assert_allclose(0.3, test_result, atol=1e-5)