コード例 #1
0
 def test_3d(self):
     exp = np.array([[[0.26726124, 0.53452248, 0.80178373],
                      [0.26726124, 0.53452248, 0.80178373],
                      [0.26726124, 0.53452248, 0.80178373]],
                     [[0.26726124, 0.53452248, 0.80178373],
                      [0.26726124, 0.53452248, 0.80178373],
                      [0.26726124, 0.53452248, 0.80178373]]])
     got = l2_normalize(np.array([[[1, 2, 3], [1, 2, 3], [1, 2, 3]],
                                  [[1, 2, 3], [1, 2, 3], [1, 2, 3]]]))
     np.testing.assert_allclose(exp, got)
コード例 #2
0
 def test_3d(self):
     exp = np.array([[[0.26726124, 0.53452248, 0.80178373],
                      [0.26726124, 0.53452248, 0.80178373],
                      [0.26726124, 0.53452248, 0.80178373]],
                     [[0.26726124, 0.53452248, 0.80178373],
                      [0.26726124, 0.53452248, 0.80178373],
                      [0.26726124, 0.53452248, 0.80178373]]])
     got = l2_normalize(
         np.array([[[1, 2, 3], [1, 2, 3], [1, 2, 3]],
                   [[1, 2, 3], [1, 2, 3], [1, 2, 3]]]))
     np.testing.assert_allclose(exp, got)