class_docstr: XCollector is a data collector which takes processed related prediction probabilities to calculate Fidelity+
  and Fidelity-.
  
  Args:
      sparsity (float): The Sparsity is use to transform the soft mask to a hard one.
  
  .. note::
      For more examples, see `benchmarks/xgraph
      <https://github.com/divelab/DIG/tree/dig/benchmarks/xgraph>`_.
docstr: Return the Sparsity value.
docstr_tok: ["Return","the","Sparsity","value","."]
code: def sparsity(self):
      r"""
      Return the Sparsity value.
      """
      if self.__sparsity is not None:
          return self.__sparsity
      else:
          if None in self.__related_preds["sparsity"]:
              return None
          else:
              return (
                  torch.tensor(self.__related_preds["sparsity"])
                  .mean()
                  .item()
              )
  
imports: import torch
  import torch.nn
  from typing import List, Union
  from torch import Tensor
  import numpy
  from torch_geometric.data.data import Data
  from torch_geometric.nn import MessagePassing
label_desc: Use image node_id 7 for calling the XCollector obj's underlying member method code with example usage: obj.sparsity() and returns: self, None, torch