コード例 #1
0
ファイル: hamming_test.py プロジェクト: suspectxx/addons
 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)
コード例 #2
0
ファイル: hamming_test.py プロジェクト: xuhao1/addons
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)