def test_complex_tensor_with_nonzero_imag_raises(self):
   x = ops.convert_to_tensor([1., 2, 0])
   y = ops.convert_to_tensor([1., 2, 0])
   z = math_ops.complex(x, y)
   with self.test_session():
     with self.assertRaisesOpError("ABC123"):
       linear_operator_util.assert_zero_imag_part(z, message="ABC123").run()
 def test_complex_tensor_with_imag_zero_doesnt_raise(self):
   x = ops.convert_to_tensor([1., 0, 3])
   y = ops.convert_to_tensor([0., 0, 0])
   z = math_ops.complex(x, y)
   with self.test_session():
     # Should not raise.
     linear_operator_util.assert_zero_imag_part(z, message="ABC123").run()
 def test_complex_tensor_with_nonzero_imag_raises(self):
   x = tf.convert_to_tensor([1., 2, 0])
   y = tf.convert_to_tensor([1., 2, 0])
   z = tf.complex(x, y)
   with self.test_session():
     with self.assertRaisesOpError("ABC123"):
       linear_operator_util.assert_zero_imag_part(z, message="ABC123").run()
 def test_complex_tensor_with_imag_zero_doesnt_raise(self):
   x = tf.convert_to_tensor([1., 0, 3])
   y = tf.convert_to_tensor([0., 0, 0])
   z = tf.complex(x, y)
   with self.test_session():
     # Should not raise.
     linear_operator_util.assert_zero_imag_part(z, message="ABC123").run()
예제 #5
0
 def _assert_self_adjoint(self):
     return linear_operator_util.assert_zero_imag_part(
         self._diag,
         message=(
             "This diagonal operator contained non-zero imaginary values.  "
             " Thus it was not self-adjoint."))
 def test_real_tensor_doesnt_raise(self):
     x = ops.convert_to_tensor([0., 2, 3])
     with self.test_session():
         # Should not raise.
         linear_operator_util.assert_zero_imag_part(x,
                                                    message="ABC123").run()
 def test_real_tensor_doesnt_raise(self):
   x = ops.convert_to_tensor([0., 2, 3])
   with self.test_session():
     # Should not raise.
     linear_operator_util.assert_zero_imag_part(x, message="ABC123").run()
 def _assert_self_adjoint(self):
   return linear_operator_util.assert_zero_imag_part(
       self._diag,
       message=(
           "This diagonal operator contained non-zero imaginary values.  "
           " Thus it was not self-adjoint."))