def sparsity_measure(input):
    """
    Returns the sparsity rate of the input sparse tensor, i.e. the rate of zero elements.

    Args:
        input (`torch.sparse.Tensor`): input tensor.

    Returns:
        (float): sparsity rate.
    """
    return input._nnz() / (input.size(0) * input.size(1))