code: def sparsity(tensor):
      """Computes the sparsity of a tensor.
  
      Sparsity is the fraction of zero elements in a tensor.
      If a tensor has a density of 0.0, then it has all zero elements.
      Sparsity and density are complementary.
  
      Args:
          tensor: the tensor for which we compute the density.
  
      Returns:
          sparsity (float)
      """
      return 1.0 - density(tensor)
  
imports: import argparse
  from collections import OrderedDict
  from copy import deepcopy
  import logging
  import operator
  import random
  import numpy
  import torch
  import torch.nn
  import torch.backends.cudnn
  import yaml
  import inspect
label_desc: Use image node_id 13 for calling a global function with example usage: sparsity(tensor) and returns: unknown