code: def convert_inputs_to_dtensor(inputs, mesh):
      """Convert any input types to DTensor instance."""
      if isinstance(inputs, DTensorDistributedValue):
          return inputs.get_dtensor()
      elif isinstance(inputs, values_lib.DistributedValues):
          return convert_per_replica_to_dtensor(inputs, mesh)
      elif isinstance(
          inputs, input_util._DTensorIterator
      ):  # pylint: disable=protected-access
          return inputs
      elif tensor_util.is_tensor(inputs):
          if context.executing_eagerly():
              if d_api.is_dtensor(inputs):
                  return inputs
              else:
                  # For a non-dtensor input in eager context, we could choose to replica
                  # them into per-replica and then pack them into dtensor. However, this
                  # will cause an eager/graph discrepancy since we can't do this check in
                  # the graph context. For now, we will ask user to provide a distributed
                  # value for inputs.
                  _raise_unsupported_input_type_error(inputs)
          else:
              # For graph context, since we can't check if they are dtensor or not. We
              # will assume the value is already distributed. This is a critical use
              # case for keras, where all the inputs are pre-distributed via strategy,
              # and the train function execute within graph context.
              return inputs
      else:
          # For any other types.
          _raise_unsupported_input_type_error(inputs)
  
imports: from tensorflow.dtensor.python import accelerator_util
  from tensorflow.dtensor.python import api
  from tensorflow.dtensor.python import input_util
  from tensorflow.dtensor.python import layout
  from tensorflow.python.distribute import cross_device_ops
  from tensorflow.python.distribute import device_util
  from tensorflow.python.distribute import distribute_lib
  from tensorflow.python.distribute import reduce_util
  from tensorflow.python.distribute import values
  from tensorflow.python.eager import context
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_conversion_registry
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import summary_ops_v2
label_desc: Use image node_id 3 for calling a global function with example usage: convert_inputs_to_dtensor(inputs, mesh) and returns: inputs, convert_per_replica_to_dtensor, inputs, inputs, inputs