code: def _dtype(cls, tensor: tf.Tensor) -> tf.Tensor:
          '''Converts `tensor` to tf.float32 datatype if needed.'''
          if tensor.dtype != tf.float32:
              tensor = tf.cast(tensor, tf.float32)
          return tensof _dtype(cls, tensor: tf.Tensor) -> tf.Tensor:
          '''Converts `tensor` to tf.float32 datatype if needed.'''
          if tensor.dtype != tf.float32:
              tensor = tf.cast(tensor, tf.float32)
          return tensor
docs: Converts `tensor` to tf.float32 datatype if needed.