code: def _calculate_sparsity(tensor):
      return ((tensor == 0).sum() / tensor.numel()).item()
  
imports: import logging
  import torch
  import torch.ao.quantization
  from torch import nn
  from torch.ao import pruning
  from torch.testing._internal.common_utils import TestCase
  from torch.ao.quantization.quantize_fx import prepare_fx, convert_fx, convert_to_reference_fx, prepare_qat_fx
  from torch.ao.pruning import fqn_to_module
label_desc: Use image node_id 3 for calling a global function with example usage: _calculate_sparsity(tensor) and returns: unknown