code: def sparsity_ch(tensor):
      """Channel-wise sparsity for 4D tensors"""
      if tensor.dim() != 4:
          return 0
      nonzero_channels = len(non_zero_channels(tensor))
      n_channels = tensor.size(1)
      return 1 - nonzero_channels / n_channels
  
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 19 for calling a global function with example usage: sparsity_ch(tensor) and returns: unknown, int