コード例 #1
0
ファイル: test_dot.py プロジェクト: TalkingData/edward
 def test_dot(self):
     with self.test_session():
         a = tf.ones([5]) * np.arange(5)
         b = tf.diag(tf.ones([5]))
         self.assertAllEqual(dot(a, b).eval(), 
                             a.eval()[np.newaxis].dot(b.eval()))
         self.assertAllEqual(dot(b, a).eval(), 
                             b.eval().dot(a.eval()[:, np.newaxis]))
コード例 #2
0
ファイル: dot_test.py プロジェクト: JoyceYa/edward
 def test_dot(self):
   with self.test_session():
     a = tf.constant(np.arange(5, dtype=np.float32))
     b = tf.diag(tf.ones([5]))
     self.assertAllEqual(dot(a, b).eval(),
                         np.dot(a.eval(), b.eval()))
     self.assertAllEqual(dot(b, a).eval(),
                         np.dot(b.eval(), a.eval()))
コード例 #3
0
 def test_all_finite_raises(self):
     with self.test_session():
         a = np.inf * tf.ones([5])
         b = tf.diag(tf.ones([5]))
         with self.assertRaisesOpError('Inf'):
             dot(a, b).eval()
         a = tf.ones([5]) * np.arange(5)
         b = np.inf * tf.diag(tf.ones([5]))
         with self.assertRaisesOpError('Inf'):
             dot(a, b).eval()
コード例 #4
0
ファイル: test_dot.py プロジェクト: xsongx/edward
 def test_dot(self):
     with self.test_session():
         a = tf.ones([5]) * np.arange(5)
         b = tf.diag(tf.ones([5]))
         self.assertAllEqual(
             dot(a, b).eval(),
             a.eval()[np.newaxis].dot(b.eval()))
         self.assertAllEqual(
             dot(b, a).eval(),
             b.eval().dot(a.eval()[:, np.newaxis]))
コード例 #5
0
ファイル: test_dot.py プロジェクト: TalkingData/edward
 def test_all_finite_raises(self):
     with self.test_session():
         a = np.inf * tf.ones([5]) * np.arange(5)
         b = tf.diag(tf.ones([5])) 
         with self.assertRaisesOpError('Inf'):
             dot(a, b).eval()
         a = tf.ones([5]) * np.arange(5)
         b = np.inf * tf.diag(tf.ones([5])) 
         with self.assertRaisesOpError('Inf'):
             dot(a, b).eval()
コード例 #6
0
 def test_dot(self):
     with self.test_session():
         a = tf.constant(np.arange(5, dtype=np.float32))
         b = tf.diag(tf.ones([5]))
         self.assertAllEqual(dot(a, b).eval(), np.dot(a.eval(), b.eval()))
         self.assertAllEqual(dot(b, a).eval(), np.dot(b.eval(), a.eval()))
コード例 #7
0
ファイル: test_dot.py プロジェクト: appcoreopc/edward
def test_dot():
    with sess.as_default():
        assert np.all(dot(a, b).eval() == a.eval()[np.newaxis].dot(b.eval()))
        assert np.all(dot(b, a).eval() == b.eval().dot(a.eval()[:, np.newaxis]))
コード例 #8
0
ファイル: test_dot.py プロジェクト: wangxiao5791509/edward
def test_dot():
    with sess.as_default():
        assert np.all(dot(a, b).eval() == a.eval()[np.newaxis].dot(b.eval()))
        assert np.all(
            dot(b, a).eval() == b.eval().dot(a.eval()[:, np.newaxis]))