docstr: Checks that assert_binary raises exceptions for invalid input.
docstr_tok: ["Checks","that","assert_binary","raises","exceptions","for","invalid","input","."]
code: def test_assert_binary_exception_raised(self, dtype):
      """Checks that assert_binary raises exceptions for invalid input."""
      tensor_size = np.random.randint(3) + 1
      tensor_shape = np.random.randint(
          1, 10, size=(tensor_size)
      ).tolist()
      num_elements = np.prod(tensor_shape)
  
      # Vector with all ones except for a single negative entry.
      vector_with_negative = np.ones(num_elements)
      vector_with_negative[np.random.randint(num_elements)] = -1
      vector_with_negative = vector_with_negative.reshape(tensor_shape)
      vector_with_negative = tf.convert_to_tensor(
          value=vector_with_negative, dtype=dtype
      )
  
      # Vector with all zeros except for a single 0.5 (or 2 in case dtype=int).
      vector = np.zeros(num_elements)
      vector[np.random.randint(num_elements)] = 2
      vector = vector.reshape(tensor_shape)
      vector = tf.convert_to_tensor(value=vector, dtype=dtype)
      vector = vector - tf.math.floordiv(vector, 4) * 3
  
      with self.subTest(name="has_negative_number"):
          with self.assertRaises(tf.errors.InvalidArgumentError):
              self.evaluate(asserts.assert_binary(vector_with_negative))
  
      with self.subTest(name="has_non_binary_number"):
          with self.assertRaises(tf.errors.InvalidArgumentError):
              self.evaluate(asserts.assert_binary(vector))
  
imports: from absl.testing import flagsaver
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tensorflow_graphics.util import asserts
  from tensorflow_graphics.util import test_case
label_desc: Use image node_id 22 for calling the AssertsTest obj's underlying member method code with example usage: obj.test_assert_binary_exception_raised(dtype) without return types