def translate_dtype(dtype):
  """Translate numpy dtype into a string.

  The 'object' type is understood as a TensorFlow string and translated into
  'string'.

  Args:
    dtype: A numpy dtype object.

  Returns:
    A string representing the data type.
  """
  out = str(dtype)
  # String-type TensorFlow Tensors are represented as object-type arrays in
  # numpy. We map the type name back to 'string' for clarity.
  return 'string' if out == 'object' else out