code: def to_default_float(x: TensorData) -> tf.Tensor:
      if not tf.is_tensor(x):
          # workaround for the fact that tf.cast(, dtype=tf.float64) doesn't directly convert
          # python floats to tf.float64 tensors. Instead, it converts the python float to a
          # tf.float32 tensor, and then casts that to be tf.float64. This results in a loss
          # of precision. See https://github.com/tensorflow/tensorflow/issues/57779 for more context.
          return tf.convert_to_tensor(x, default_float())
      return tf.cast(x, dtype=default_float())
  
file_path: GPflow/gpflow/utilities/misc.py
imports: from typing import Callable, Iterable, List, Optional, Union
  import tensorflow
  import tensorflow_probability
  from check_shapes import check_shapes
  from ..base import TensorData
  from ..config import default_float, default_int
label_desc: Use image node_id 2 for calling a global function with example usage: to_default_float(x) and returns: tf, tf