code: def _is_sparse(x):
    
    return (
        isinstance(x, (tf.SparseTensor, tf_v1.SparseTensorValue)) or
        (hasattr(x, "is_sparse") and x.is_sparse))
docs: Returns whether x is a SparseTensor or a parsed sparse tensor info.