Ejemplo n.º 1
0
 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]))
Ejemplo n.º 2
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()))
 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()
Ejemplo n.º 4
0
 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]))
Ejemplo n.º 5
0
 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()
 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()))
Ejemplo n.º 7
0
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]))
Ejemplo n.º 8
0
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]))