예제 #1
0
 def test_custom_tolerance_broadcasts(self):
   q = linalg.qr(random_ops.random_uniform([3, 3], dtype=self.dtype))[0]
   e = constant_op.constant([0.1, 0.2, 0.3], dtype=self.dtype)
   a = linalg.solve(q, linalg.transpose(a=e * q), adjoint=True)
   self.assertAllEqual([3, 2, 1, 0],
                       self.evaluate(
                           linalg.matrix_rank(
                               a, tol=[[0.09], [0.19], [0.29], [0.31]])))
예제 #2
0
 def test_nonsquare(self):
   x_ = np.array(
       [
           [
               [2, 3, -2, 2],  # = row2+row3
               [-1, 1, -2, 4],
               [3, 2, 0, -2]
           ],
           [
               [0, 2, 0, 6],  # = 2*row2
               [0, 1, 0, 3],
               [0, 3, 0, 9]
           ]
       ],  # = 3*row2
       self.dtype)
   x = array_ops.placeholder_with_default(
       x_, shape=x_.shape if self.use_static_shape else None)
   self.assertAllEqual([2, 1], self.evaluate(linalg.matrix_rank(x)))