code: def assert_binary(
      tensor: type_alias.TensorLike, name: str = "assert_binary"
  ) -> tf.Tensor:
      """Asserts that all the values in the tensor are zeros or ones.
  
      Args:
        tensor: A tensor of shape `[A1, ..., An]` containing the values we want to
          check.
        name: A name for this op. Defaults to 'assert_binary'.
  
      Returns:
        The input tensor, with dependence on the assertion operator in the graph.
  
      Raises:
        tf.errors.InvalidArgumentError: If any of the values in the tensor is not
        zero or one.
      """
      if not FLAGS[tfg_flags.TFG_ADD_ASSERTS_TO_GRAPH].value:
          return tensor
  
      with tf.name_scope(name):
          tensor = tf.convert_to_tensor(value=tensor)
          condition = tf.reduce_all(
              input_tensor=tf.logical_or(
                  tf.equal(tensor, 0), tf.equal(tensor, 1)
              )
          )
  
          with tf.control_dependencies(
              [tf.debugging.Assert(condition, data=[tensor])]
          ):
              return tf.identity(tensor)
  
file_path: graphics/tensorflow_graphics/util/asserts.py
imports: from typing import Optional
  from absl import flags
  import numpy
  import tensorflow
  from tensorflow_graphics.util import tfg_flags
  from tensorflow_graphics.util import type_alias
label_desc: Use image node_id 8 for calling a global function with example usage: assert_binary(tensor, name) and returns: tensor, tf