code: def floating_tensor_to_f32(x):
      """Cast x to float32 if a floating-point Tensor, else return it.
  
      This is meant to be used with `tf.nest.map_structure`, or other
      situations where it may not be obvious whether an object is a Tensor
      or not, or has floating dtype or not.
  
      Args:
        x: The object to be cast or left be.
  
      Returns:
        x: x, either cast or left be.
  
      """
      if tf.is_tensor(x) and dtype_util.is_floating(x.dtype):
          return tf.cast(x, dtype=tf.float32)
      else:
          return x
  
file_path: probability/tensorflow_probability/python/internal/numerics_testing.py
imports: import functools
  from absl import logging
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.math import gradient
label_desc: Use image node_id 1 for calling a global function with example usage: floating_tensor_to_f32(x) and returns: tf, x