parameters: (tensors)
return_statement: return ret
docstring: Serializes sparse tensors.
  
    Args:
      tensors: a tensor structure to serialize.
  
    Returns:
      `tensors` with any sparse tensors replaced by their serialized version.
docstring_summary: Serializes sparse tensors.
docstring_tokens: Serializes sparse tensors .
function: def serialize_sparse_tensors(tensors):
    """Serializes sparse tensors.
  
    Args:
      tensors: a tensor structure to serialize.
  
    Returns:
      `tensors` with any sparse tensors replaced by their serialized version.
    """
  
    ret = nest.pack_sequence_as(tensors, [
        sparse_ops.serialize_sparse(tensor, out_type=dtypes.variant)
        if isinstance(tensor, sparse_tensor.SparseTensor) else tensor
        for tensor in nest.flatten(tensors)
    ])
    return ret
function_tokens: def serialize_sparse_tensors ( tensors ) : ret = nest . pack_sequence_as ( tensors , [ sparse_ops . serialize_sparse ( tensor , out_type = dtypes . variant ) if isinstance ( tensor , sparse_tensor . SparseTensor ) else tensor for tensor in nest . flatten ( tensors ) ] ) return ret